about summary refs log tree commit diff
path: root/spec/controllers
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2018-05-23 13:32:10 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-05-23 06:32:10 +0200
commit6d99a0b652d866d41a56140aa695864b20830411 (patch)
tree9ab03107fcbc41390d3a03d50dd393aba3611ed6 /spec/controllers
parent4d81809f36fcbfe787e23d490f2cb0ad943ab32c (diff)
Fix tests for invites controller (regression from 4d81809f36fcbfe787e23d490f2cb0ad943ab32c) (#7597)
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/invites_controller_spec.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb
index c5c6cb651..9f5ab67c3 100644
--- a/spec/controllers/invites_controller_spec.rb
+++ b/spec/controllers/invites_controller_spec.rb
@@ -7,15 +7,21 @@ describe InvitesController do
     sign_in user
   end
 
+  around do |example|
+    min_invite_role = Setting.min_invite_role
+    example.run
+    Setting.min_invite_role = min_invite_role
+  end
+
   describe 'GET #index' do
     subject { get :index }
 
+    let(:user) { Fabricate(:user, moderator: false, admin: false) }
     let!(:invite) { Fabricate(:invite, user: user) }
 
     context 'when user is a staff' do
-      let(:user) { Fabricate(:user, moderator: true, admin: false) }
-
       it 'renders index page' do
+        Setting.min_invite_role = 'user'
         expect(subject).to render_template :index
         expect(assigns(:invites)).to include invite
         expect(assigns(:invites).count).to eq 1
@@ -23,9 +29,8 @@ describe InvitesController do
     end
 
     context 'when user is not a staff' do
-      let(:user) { Fabricate(:user, moderator: false, admin: false) }
-
       it 'returns 403' do
+        Setting.min_invite_role = 'modelator'
         expect(subject).to have_http_status 403
       end
     end