wedding-planner/spec/requests/tables_arrangements_spec.rb
Manuel Bustillo 3bfe889747
All checks were successful
Check usage of free licenses / check-licenses (pull_request) Successful in 32s
Add copyright notice / copyright_notice (pull_request) Successful in 1m4s
Run unit tests / unit_tests (pull_request) Successful in 2m33s
Redo TablesArrangements#show to display arrangement ID and discomfort breakdown
2024-12-16 18:52:34 +01:00

84 lines
2.7 KiB
Ruby

# Copyright (C) 2024 Manuel Bustillo
require 'swagger_helper'
RSpec.describe 'tables_arrangements', type: :request do
path '/{slug}/tables_arrangements' do
get('list tables arrangements') do
tags 'Tables Arrangements'
produces 'application/json'
parameter Swagger::Schema::SLUG
response(200, 'successful') do
schema type: :array,
items: {
type: :object,
required: %i[id name discomfort],
properties: {
id: { type: :string, format: :uuid },
name: { type: :string },
discomfort: { type: :integer }
}
}
xit
end
regular_api_responses
end
end
path '/{slug}/tables_arrangements/{id}' do
get('show tables arrangement') do
tags 'Tables Arrangements'
produces 'application/json'
parameter Swagger::Schema::SLUG
parameter Swagger::Schema::ID
response(200, 'successful') do
schema type: :object,
required: %i[id tables],
properties: {
id: { type: :string, format: :uuid },
tables: {
type: :array,
items: {
type: :object,
required: %i[number guests discomfort],
properties: {
number: { type: :integer },
guests: {
type: :array,
items: {
type: :object,
required: %i[id name color],
properties: {
id: { type: :string, format: :uuid },
name: { type: :string },
color: { type: :string }
}
}
},
discomfort: {
type: :object,
required: %i[discomfort breakdown],
properties: {
discomfort: { type: :number },
breakdown: {
type: :object,
required: %i[table_size_penalty cohesion_penalty],
properties: {
table_size_penalty: { type: :number },
cohesion_penalty: { type: :number }
}
}
}
}
}
}
}
}
xit
end
regular_api_responses
end
end
end