28_introduce_rswag #35

Merged
philipp merged 46 commits from 28_introduce_rswag into develop 2023-01-05 13:45:47 +01:00
2 changed files with 8 additions and 22 deletions
Showing only changes of commit a32bc88298 - Show all commits

View file

@ -26,11 +26,10 @@ describe 'Financial Transaction', type: :request do
} }
} }
} }
let(:page) { 1 }
let(:per_page) { 10 }
run_test! run_test!
end end
it_handles_invalid_scope it_handles_invalid_token_and_scope
end end
end end
@ -52,22 +51,9 @@ describe 'Financial Transaction', type: :request do
let(:id) { FinancialTransaction.create(user: user).id } let(:id) { FinancialTransaction.create(user: user).id }
run_test! run_test!
end end
it_handles_invalid_scope_with_id(:financial_transaction, 'missing scope or no permission') it_handles_invalid_token_with_id :financial_transaction
it_handles_invalid_scope_with_id :financial_transaction
response '404', 'financial transaction not found' do it_cannot_find_object 'financial transaction not found'
schema type: :object, properties: {
financial_transaction: {
type: :array,
items: {
'$ref': '#/components/schemas/FinancialTransaction'
}
}
}
let(:id) { 'invalid' }
run_test!
end
# response 403
it_handles_invalid_scope_with_id(:financial_transaction, 'missing scope or no permission')
end end
end end
end end

View file

@ -30,7 +30,7 @@ module ApiHelper
end end
end end
def self.it_handles_invalid_scope(description = "missing scope") def self.it_handles_invalid_scope(description = 'missing scope')
context 'with invalid scope' do context 'with invalid scope' do
let(:api_scopes) { ['none'] } let(:api_scopes) { ['none'] }
@ -41,7 +41,7 @@ module ApiHelper
end end
end end
def self.it_handles_invalid_scope_with_id(class_sym, description) def self.it_handles_invalid_scope_with_id(class_sym, description = 'missing scope')
context 'with invalid scope' do context 'with invalid scope' do
let(:api_scopes) { ['none'] } let(:api_scopes) { ['none'] }
let(:id) { create(class_sym).id } let(:id) { create(class_sym).id }
@ -53,7 +53,7 @@ module ApiHelper
end end
end end
def self.it_cannot_find_object(description = "not found") def self.it_cannot_find_object(description = 'not found')
let(:id) { 'invalid' } let(:id) { 'invalid' }