0
0
Fork 0

Convert invites controller spec to system/request specs (#31755)

This commit is contained in:
Matt Jankowski 2024-09-05 07:54:27 -04:00 committed by GitHub
parent 5b1ae15a36
commit e820cc30b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 135 additions and 85 deletions

View 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