28_introduce_rswag #35
2 changed files with 8 additions and 22 deletions
|
@ -26,11 +26,10 @@ describe 'Financial Transaction', type: :request do
|
|||
}
|
||||
}
|
||||
}
|
||||
let(:page) { 1 }
|
||||
let(:per_page) { 10 }
|
||||
|
||||
run_test!
|
||||
end
|
||||
it_handles_invalid_scope
|
||||
it_handles_invalid_token_and_scope
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -52,22 +51,9 @@ describe 'Financial Transaction', type: :request do
|
|||
let(:id) { FinancialTransaction.create(user: user).id }
|
||||
run_test!
|
||||
end
|
||||
it_handles_invalid_scope_with_id(:financial_transaction, 'missing scope or no permission')
|
||||
|
||||
response '404', 'financial transaction not found' do
|
||||
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')
|
||||
it_handles_invalid_token_with_id :financial_transaction
|
||||
it_handles_invalid_scope_with_id :financial_transaction
|
||||
it_cannot_find_object 'financial transaction not found'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ module ApiHelper
|
|||
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
|
||||
let(:api_scopes) { ['none'] }
|
||||
|
||||
|
@ -41,7 +41,7 @@ module ApiHelper
|
|||
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
|
||||
let(:api_scopes) { ['none'] }
|
||||
let(:id) { create(class_sym).id }
|
||||
|
@ -53,7 +53,7 @@ module ApiHelper
|
|||
end
|
||||
end
|
||||
|
||||
def self.it_cannot_find_object(description = "not found")
|
||||
def self.it_cannot_find_object(description = 'not found')
|
||||
let(:id) { 'invalid' }
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue