about summary refs log tree commit diff
path: root/spec/controllers/admin/base_controller_spec.rb
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-04-04 13:55:42 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-04-04 13:55:42 -0500
commitbda1782cd864ed3aabb5a4d87359a1cb7595f4a6 (patch)
tree4ecb8623959b616fec9ab2a9c855048fb8c2da49 /spec/controllers/admin/base_controller_spec.rb
parent77b650b69c8146a2acf4e7d270343f89c9838690 (diff)
parent6611100480c86c07972c1223e7231c136966e11d (diff)
Merge remote-tracking branch 'personal/merge/tootsuite/master' into gs-master
Diffstat (limited to 'spec/controllers/admin/base_controller_spec.rb')
-rw-r--r--spec/controllers/admin/base_controller_spec.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/spec/controllers/admin/base_controller_spec.rb b/spec/controllers/admin/base_controller_spec.rb
index 2b60e7e92..9ac833623 100644
--- a/spec/controllers/admin/base_controller_spec.rb
+++ b/spec/controllers/admin/base_controller_spec.rb
@@ -9,18 +9,25 @@ describe Admin::BaseController, type: :controller do
     end
   end
 
-  it 'renders admin layout' do
+  it 'requires administrator or moderator' do
     routes.draw { get 'success' => 'admin/base#success' }
-    sign_in(Fabricate(:user, admin: true))
+    sign_in(Fabricate(:user, admin: false, moderator: false))
     get :success
-    expect(response).to render_template layout: 'admin'
+
+    expect(response).to have_http_status(:forbidden)
   end
 
-  it 'requires administrator' do
+  it 'renders admin layout as a moderator' do
     routes.draw { get 'success' => 'admin/base#success' }
-    sign_in(Fabricate(:user, admin: false))
+    sign_in(Fabricate(:user, moderator: true))
     get :success
+    expect(response).to render_template layout: 'admin'
+  end
 
-    expect(response).to redirect_to('/')
+  it 'renders admin layout as an admin' do
+    routes.draw { get 'success' => 'admin/base#success' }
+    sign_in(Fabricate(:user, admin: true))
+    get :success
+    expect(response).to render_template layout: 'admin'
   end
 end