mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-03 17:56:26 +01:00
Fix tests for invites controller (regression from 4d81809f36
) (#7597)
This commit is contained in:
parent
4d81809f36
commit
6d99a0b652
@ -7,15 +7,21 @@ describe InvitesController do
|
|||||||
sign_in user
|
sign_in user
|
||||||
end
|
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
|
describe 'GET #index' do
|
||||||
subject { get :index }
|
subject { get :index }
|
||||||
|
|
||||||
|
let(:user) { Fabricate(:user, moderator: false, admin: false) }
|
||||||
let!(:invite) { Fabricate(:invite, user: user) }
|
let!(:invite) { Fabricate(:invite, user: user) }
|
||||||
|
|
||||||
context 'when user is a staff' do
|
context 'when user is a staff' do
|
||||||
let(:user) { Fabricate(:user, moderator: true, admin: false) }
|
|
||||||
|
|
||||||
it 'renders index page' do
|
it 'renders index page' do
|
||||||
|
Setting.min_invite_role = 'user'
|
||||||
expect(subject).to render_template :index
|
expect(subject).to render_template :index
|
||||||
expect(assigns(:invites)).to include invite
|
expect(assigns(:invites)).to include invite
|
||||||
expect(assigns(:invites).count).to eq 1
|
expect(assigns(:invites).count).to eq 1
|
||||||
@ -23,9 +29,8 @@ describe InvitesController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is not a staff' do
|
context 'when user is not a staff' do
|
||||||
let(:user) { Fabricate(:user, moderator: false, admin: false) }
|
|
||||||
|
|
||||||
it 'returns 403' do
|
it 'returns 403' do
|
||||||
|
Setting.min_invite_role = 'modelator'
|
||||||
expect(subject).to have_http_status 403
|
expect(subject).to have_http_status 403
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user