wedding-planner/spec/requests/expenses_spec.rb
Manuel Bustillo 91bbae1c63
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 59s
Add copyright notice / copyright_notice (pull_request) Successful in 2m21s
Run unit tests / unit_tests (pull_request) Successful in 3m2s
Build Nginx-based docker image / build-static-assets (pull_request) Successful in 25m17s
Add copyright notice
2025-01-13 20:38:47 +00:00

84 lines
2.0 KiB
Ruby

# Copyright (C) 2024 Manuel Bustillo
# Copyright (C) 2024-2025 LibreWeddingPlanner contributors
# frozen_string_literal: true
require 'swagger_helper'
RSpec.describe 'expenses' do
path '/{slug}/expenses' do
get('list expenses') do
tags 'Expenses'
produces 'application/json'
parameter Swagger::Schema::SLUG
response(200, 'successful') do
schema type: :array,
items: {
type: :object,
required: %i[id name amount pricing_type],
properties: {
id: { type: :string, format: :uuid },
**Swagger::Schema::EXPENSE
}
}
xit
end
regular_api_responses
end
post 'create expense' do
tags 'Expenses'
consumes 'application/json'
produces 'application/json'
parameter Swagger::Schema::SLUG
parameter name: :body, in: :body, schema: {
type: :object,
required: %i[expense],
properties: {
expense: {
type: :object,
required: %i[name amount pricing_type],
properties: Swagger::Schema::EXPENSE
}
}
}
response_empty201
response422
regular_api_responses
end
end
path '/{slug}/expenses/{id}' do
patch('update expense') do
tags 'Expenses'
consumes 'application/json'
produces 'application/json'
parameter Swagger::Schema::SLUG
parameter name: 'id', in: :path, type: :string, format: :uuid, description: 'id'
parameter name: :body, in: :body, schema: {
type: :object,
properties: Swagger::Schema::EXPENSE
}
response_empty200
response422
response404
regular_api_responses
end
delete('delete expense') do
tags 'Expenses'
produces 'application/json'
parameter Swagger::Schema::SLUG
parameter Swagger::Schema::ID
response_empty200
response404
regular_api_responses
end
end
end