# Copyright (C) 2024 Manuel Bustillo require 'swagger_helper' RSpec.describe 'expenses', type: :request 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_empty_201 response_422 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_empty_200 response_422 response_404 regular_api_responses end delete('delete expense') do tags 'Expenses' produces 'application/json' parameter Swagger::Schema::SLUG parameter Swagger::Schema::ID response_empty_200 response_404 regular_api_responses end end end