2023-06-14 17:34:01 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-09-04 15:12:25 +10:00
|
|
|
RSpec.shared_examples 'forbidden for wrong scope' do |wrong_scope|
|
2023-06-14 17:34:01 +10:00
|
|
|
let(:scopes) { wrong_scope }
|
|
|
|
|
|
|
|
it 'returns http forbidden' do
|
|
|
|
# Some examples have a subject which needs to be called to make a request
|
|
|
|
subject if request.nil?
|
|
|
|
|
|
|
|
expect(response).to have_http_status(403)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-09-04 15:12:25 +10:00
|
|
|
RSpec.shared_examples 'forbidden for wrong role' do |wrong_role|
|
2023-06-14 17:34:01 +10:00
|
|
|
let(:role) { UserRole.find_by(name: wrong_role) }
|
|
|
|
|
|
|
|
it 'returns http forbidden' do
|
|
|
|
# Some examples have a subject which needs to be called to make a request
|
|
|
|
subject if request.nil?
|
|
|
|
|
|
|
|
expect(response).to have_http_status(403)
|
|
|
|
end
|
|
|
|
end
|