0
0
Fork 0

Extract shared examples from api specs (#25387)

This commit is contained in:
Matt Jankowski 2023-06-14 03:34:01 -04:00 committed by GitHub
parent ae2790d84f
commit 4c5f62de99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 23 additions and 256 deletions

View file

@ -9,26 +9,6 @@ RSpec.describe 'Canonical Email Blocks' do
let(:scopes) { 'admin:read:canonical_email_blocks admin:write:canonical_email_blocks' }
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
shared_examples 'forbidden for wrong scope' do |wrong_scope|
let(:scopes) { wrong_scope }
it 'returns http forbidden' do
subject
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
subject
expect(response).to have_http_status(403)
end
end
describe 'GET /api/v1/admin/canonical_email_blocks' do
subject do
get '/api/v1/admin/canonical_email_blocks', headers: headers, params: params