28_introduce_rswag #35

Merged
philipp merged 46 commits from 28_introduce_rswag into develop 2023-01-05 13:45:47 +01:00
9 changed files with 17 additions and 13 deletions
Showing only changes of commit 4c0a7ae938 - Show all commits

View file

@ -33,7 +33,7 @@ describe 'Article Categories', type: :request do
get 'find article category by id' do get 'find article category by id' do
tags 'Category' tags 'Category'
produces 'application/json' produces 'application/json'
parameter name: :id, in: :path, type: :string id_url_param
response '200', 'article category found' do response '200', 'article category found' do
schema type: :object, properties: { schema type: :object, properties: {

View file

@ -35,7 +35,7 @@ describe 'Financial Transaction Classes', type: :request do
get 'Retrieves a financial transaction class' do get 'Retrieves a financial transaction class' do
tags 'Category' tags 'Category'
produces 'application/json' produces 'application/json'
parameter name: :id, in: :path, type: :string id_url_param
response '200', 'financial transaction class found' do response '200', 'financial transaction class found' do
schema type: :object, properties: { schema type: :object, properties: {

View file

@ -33,7 +33,7 @@ describe 'Financial Transaction types', type: :request do
get 'find financial transaction type by id' do get 'find financial transaction type by id' do
tags 'Category' tags 'Category'
produces 'application/json' produces 'application/json'
parameter name: :id, in: :path, type: :string id_url_param
response '200', 'financial transaction type found' do response '200', 'financial transaction type found' do
schema type: :object, properties: { schema type: :object, properties: {

View file

@ -37,7 +37,7 @@ describe 'Financial Transaction', type: :request do
get 'Retrieves a financial transaction ' do get 'Retrieves a financial transaction ' do
tags 'Financial Transaction' tags 'Financial Transaction'
produces 'application/json' produces 'application/json'
parameter name: :id, in: :path, type: :string id_url_param
response '200', 'financial transaction found' do response '200', 'financial transaction found' do
schema type: :object, properties: { schema type: :object, properties: {

View file

@ -105,7 +105,7 @@ describe 'Order Articles', type: :request do
get 'order articles' do get 'order articles' do
tags 'Order' tags 'Order'
produces 'application/json' produces 'application/json'
parameter name: 'id', in: :path, type: :integer, minimum: 1, required: true id_url_param
let(:api_scopes) { ['orders:read', 'orders:write'] } let(:api_scopes) { ['orders:read', 'orders:write'] }
response '200', 'success' do response '200', 'success' do

View file

@ -39,7 +39,8 @@ describe 'Orders', type: :request do
get 'Order' do get 'Order' do
tags 'Order' tags 'Order'
produces 'application/json' produces 'application/json'
parameter name: 'id', in: :path, type: :integer, minimum: 1, required: true id_url_param
let(:order) { create(:order) } let(:order) { create(:order) }
let(:id) { order.id } let(:id) { order.id }

View file

@ -88,7 +88,7 @@ describe 'User', type: :request do
get 'find financial transaction by id' do get 'find financial transaction by id' do
tags 'User', 'Financial Transaction' tags 'User', 'Financial Transaction'
produces 'application/json' produces 'application/json'
parameter name: :id, in: :path, type: :string id_url_param
response '200', 'success' do response '200', 'success' do
schema type: :object, properties: { schema type: :object, properties: {

View file

@ -107,9 +107,8 @@ describe 'User', type: :request do
get 'find group order article by id' do get 'find group order article by id' do
tags 'User', 'GroupOrderArticle' tags 'User', 'GroupOrderArticle'
produces 'application/json' produces 'application/json'
parameter name: :id, in: :path, type: :string id_url_param
let(:id) { goa.id }
response '200', 'success' do response '200', 'success' do
schema type: :object, properties: { schema type: :object, properties: {
group_order_article: { group_order_article: {
@ -119,6 +118,7 @@ describe 'User', type: :request do
} }
} }
} }
let(:id) { goa.id }
run_test! do |response| run_test! do |response|
data = JSON.parse(response.body) data = JSON.parse(response.body)
expect(data['group_order_article']['id']).to eq(goa.id) expect(data['group_order_article']['id']).to eq(goa.id)
@ -155,7 +155,7 @@ describe 'User', type: :request do
tags 'User', 'GroupOrderArticle' tags 'User', 'GroupOrderArticle'
consumes 'application/json' consumes 'application/json'
produces 'application/json' produces 'application/json'
parameter name: :id, in: :path, type: :string id_url_param
parameter name: :group_order_article, in: :body, schema: { parameter name: :group_order_article, in: :body, schema: {
type: :object, type: :object,
@ -219,11 +219,9 @@ describe 'User', type: :request do
tags 'User', 'Order' tags 'User', 'Order'
consumes 'application/json' consumes 'application/json'
produces 'application/json' produces 'application/json'
id_url_param
let(:api_scopes) { ['group_orders:user'] } let(:api_scopes) { ['group_orders:user'] }
parameter name: :id, in: :path, type: :string
let(:id) { goa.id }
response '200', 'success' do response '200', 'success' do
schema type: :object, properties: { schema type: :object, properties: {
group_order_article: { group_order_article: {
@ -233,6 +231,7 @@ describe 'User', type: :request do
} }
} }
} }
let(:id) { goa.id }
run_test! run_test!
end end

View file

@ -67,5 +67,9 @@ module ApiHelper
it_handles_invalid_token(*args) it_handles_invalid_token(*args)
it_handles_invalid_scope(*args) it_handles_invalid_scope(*args)
end end
def self.id_url_param
parameter name: :id, in: :path, type: :integer, required: true
end
end end
end end