diff --git a/spec/requests/api/financial_transactions_spec.rb b/spec/requests/api/financial_transactions_spec.rb index d5c028a3..b3f3a85d 100644 --- a/spec/requests/api/financial_transactions_spec.rb +++ b/spec/requests/api/financial_transactions_spec.rb @@ -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 diff --git a/spec/support/api_helper.rb b/spec/support/api_helper.rb index b0831ed9..0c8c83d5 100644 --- a/spec/support/api_helper.rb +++ b/spec/support/api_helper.rb @@ -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' }