1
0

invites_spec.rb 726 B

12345678910111213141516171819202122232425262728293031
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Invites' do
  4. let(:user) { Fabricate(:user) }
  5. before { sign_in user }
  6. context 'when not everyone can invite' do
  7. before { UserRole.everyone.update(permissions: UserRole.everyone.permissions & ~UserRole::FLAGS[:invite_users]) }
  8. describe 'GET /invites' do
  9. it 'returns http forbidden' do
  10. get invites_path
  11. expect(response)
  12. .to have_http_status(403)
  13. end
  14. end
  15. describe 'POST /invites' do
  16. it 'returns http forbidden' do
  17. post invites_path, params: { invite: { max_users: '10', expires_in: 1800 } }
  18. expect(response)
  19. .to have_http_status(403)
  20. end
  21. end
  22. end
  23. end