52 lines
1.3 KiB
Ruby
52 lines
1.3 KiB
Ruby
# Copyright (C) 2024 Manuel Bustillo
|
|
|
|
require 'swagger_helper'
|
|
|
|
RSpec.describe 'expenses', type: :request do
|
|
path '/expenses' do
|
|
get('list expenses') do
|
|
tags 'Expenses'
|
|
produces 'application/json'
|
|
response(200, 'successful') do
|
|
schema type: :array,
|
|
items: {
|
|
type: :object,
|
|
required: %i[id name amount pricing_type],
|
|
properties: {
|
|
id: { type: :string, format: :uuid },
|
|
name: { type: :string },
|
|
amount: { type: :number },
|
|
pricing_type: { type: :string, enum: Expense.pricing_types.keys }
|
|
}
|
|
}
|
|
|
|
xit
|
|
end
|
|
regular_api_responses
|
|
end
|
|
end
|
|
|
|
path '/expenses/{id}' do
|
|
|
|
patch('update expense') do
|
|
tags 'Expenses'
|
|
consumes 'application/json'
|
|
produces 'application/json'
|
|
parameter name: 'id', in: :path, type: :string, format: :uuid, description: 'id'
|
|
parameter name: :body, in: :body, schema: {
|
|
type: :object,
|
|
properties: {
|
|
name: { type: :string },
|
|
amount: { type: :number, minimum: 0 },
|
|
pricing_type: { type: :string, enum: Expense.pricing_types.keys }
|
|
}
|
|
}
|
|
|
|
response_empty_200
|
|
response_422
|
|
response_404
|
|
regular_api_responses
|
|
end
|
|
end
|
|
end
|