Convert invites controller spec to system/request specs (#31755)
This commit is contained in:
parent
5b1ae15a36
commit
e820cc30b8
6 changed files with 135 additions and 85 deletions
31
spec/requests/invites_spec.rb
Normal file
31
spec/requests/invites_spec.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Invites' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
before { sign_in user }
|
||||
|
||||
context 'when not everyone can invite' do
|
||||
before { UserRole.everyone.update(permissions: UserRole.everyone.permissions & ~UserRole::FLAGS[:invite_users]) }
|
||||
|
||||
describe 'GET /invites' do
|
||||
it 'returns http forbidden' do
|
||||
get invites_path
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(403)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /invites' do
|
||||
it 'returns http forbidden' do
|
||||
post invites_path, params: { invite: { max_users: '10', expires_in: 1800 } }
|
||||
|
||||
expect(response)
|
||||
.to have_http_status(403)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue