wedding-planner/spec/requests/expenses_spec.rb
Manuel Bustillo b8e6df732c
Some checks failed
Check usage of free licenses / check-licenses (pull_request) Successful in 41s
Add copyright notice / copyright_notice (pull_request) Failing after 1m30s
Run unit tests / unit_tests (pull_request) Successful in 4m41s
Generate user model, document some endpoints (missing email verification)
2024-11-30 14:24:02 +01:00

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