28_introduce_rswag #35
9 changed files with 17 additions and 13 deletions
|
@ -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: {
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue