Extract shared examples from api specs (#25387)
parent
ae2790d84f
commit
4c5f62de99
17 changed files with 23 additions and 256 deletions
@ -0,0 +1,23 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
shared_examples 'forbidden for wrong scope' do |wrong_scope| |
||||
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 |
||||
|
||||
shared_examples 'forbidden for wrong role' do |wrong_role| |
||||
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 |
Loading…
Reference in new issue