about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-04-10 15:27:03 -0400
committerEugen <eugen@zeonfederated.com>2017-04-10 21:27:03 +0200
commitdbe9f33fdc9a995b07ff3b1dcd93ad02cd336649 (patch)
treed89768083aba71c27789dfb08651ef27811954cf /spec/controllers
parent1be6aa0c7fdac51e81ff7ee0c2b9184ed29ca3de (diff)
Admin base controller (#1465)
* Add Admin::BaseController to wrap admin area

Extracts the setting of the `admin` layout and verifying that users are admins
to a common base class for the admin/ controllers.

* Add basic coverage for admin/reports and admin/settings controllers
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/admin/reports_controller_spec.rb14
-rw-r--r--spec/controllers/admin/settings_controller_spec.rb14
2 files changed, 28 insertions, 0 deletions
diff --git a/spec/controllers/admin/reports_controller_spec.rb b/spec/controllers/admin/reports_controller_spec.rb
new file mode 100644
index 000000000..622ea87c1
--- /dev/null
+++ b/spec/controllers/admin/reports_controller_spec.rb
@@ -0,0 +1,14 @@
+require 'rails_helper'
+
+RSpec.describe Admin::ReportsController, type: :controller do
+  describe 'GET #index' do
+    before do
+      sign_in Fabricate(:user, admin: true), scope: :user
+    end
+
+    it 'returns http success' do
+      get :index
+      expect(response).to have_http_status(:success)
+    end
+  end
+end
diff --git a/spec/controllers/admin/settings_controller_spec.rb b/spec/controllers/admin/settings_controller_spec.rb
new file mode 100644
index 000000000..c126b645b
--- /dev/null
+++ b/spec/controllers/admin/settings_controller_spec.rb
@@ -0,0 +1,14 @@
+require 'rails_helper'
+
+RSpec.describe Admin::SettingsController, type: :controller do
+  describe 'GET #index' do
+    before do
+      sign_in Fabricate(:user, admin: true), scope: :user
+    end
+
+    it 'returns http success' do
+      get :index
+      expect(response).to have_http_status(:success)
+    end
+  end
+end