foodsoft/spec/requests/api/financial_transaction_class...

56 lines
1.5 KiB
Ruby
Raw Normal View History

2022-11-25 14:52:02 +01:00
require 'swagger_helper'
describe 'Financial Transaction Classes', type: :request do
include ApiHelper
path '/financial_transaction_classes' do
get 'financial transaction classes' do
tags 'Category'
produces 'application/json'
parameter name: "per_page", in: :query, type: :integer, required: false
parameter name: "page", in: :query, type: :integer, required: false
let(:financial_transaction_class) { create(:financial_transaction_class) }
2022-11-28 13:19:50 +01:00
2022-11-25 14:52:02 +01:00
response '200', 'success' do
schema type: :object, properties: {
2022-12-12 16:02:14 +01:00
meta: { '$ref' => '#/components/schemas/Meta' },
2022-11-25 14:52:02 +01:00
financial_transaction_class: {
type: :array,
items: {
'$ref': '#/components/schemas/FinancialTransactionClass'
}
}
}
run_test!
end
it_handles_invalid_token
end
end
path '/financial_transaction_classes/{id}' do
2022-11-28 13:19:50 +01:00
get 'Retrieves a financial transaction class' do
2022-11-25 14:52:02 +01:00
tags 'Category'
produces 'application/json'
2022-12-12 15:54:53 +01:00
id_url_param
2022-11-25 14:52:02 +01:00
response '200', 'financial transaction class found' do
schema type: :object, properties: {
financial_transaction_classes: {
type: :array,
items: {
'$ref': '#/components/schemas/FinancialTransactionClass'
}
}
}
let(:id) { create(:financial_transaction_class).id }
2022-11-25 14:52:02 +01:00
run_test!
end
it_handles_invalid_token_with_id
it_cannot_find_object 'financial transaction class not found'
2022-11-25 14:52:02 +01:00
end
end
end