api.rb 641 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. RSpec.shared_examples 'forbidden for wrong scope' do |wrong_scope|
  3. let(:scopes) { wrong_scope }
  4. it 'returns http forbidden' do
  5. # Some examples have a subject which needs to be called to make a request
  6. subject if request.nil?
  7. expect(response).to have_http_status(403)
  8. end
  9. end
  10. RSpec.shared_examples 'forbidden for wrong role' do |wrong_role|
  11. let(:role) { UserRole.find_by(name: wrong_role) }
  12. it 'returns http forbidden' do
  13. # Some examples have a subject which needs to be called to make a request
  14. subject if request.nil?
  15. expect(response).to have_http_status(403)
  16. end
  17. end