c67e9b5be8
* Replace apivore api tests with rswag * move to OpenAPI Spec 3.0.1 * a swagger UI is now reachable at http://localhost:3000/api-docs/index.html * swagger file is generated by running `RAILS_ENV=test rails rswag` and it was moved from /docs/swagger.v1.yml to /swagger/v1/swagger.yml --------- Co-authored-by: viehlieb <pf@pragma-shift.net>
53 lines
1.4 KiB
Ruby
53 lines
1.4 KiB
Ruby
require 'swagger_helper'
|
|
|
|
describe 'Article Categories', type: :request do
|
|
include ApiHelper
|
|
|
|
path '/article_categories' do
|
|
get 'article categories' do
|
|
tags 'Category'
|
|
produces 'application/json'
|
|
pagination_param
|
|
let(:order_article) { create(:order, article_count: 1).order_articles.first }
|
|
let(:stock_article) { create(:stock_article) }
|
|
let(:stock_order_article) { create(:stock_order, article_ids: [stock_article.id]).order_articles.first }
|
|
|
|
response '200', 'success' do
|
|
schema type: :object, properties: {
|
|
article_categories: {
|
|
type: :array,
|
|
items: {
|
|
'$ref': '#/components/schemas/ArticleCategory'
|
|
}
|
|
}
|
|
}
|
|
run_test!
|
|
end
|
|
|
|
it_handles_invalid_token
|
|
end
|
|
end
|
|
|
|
path '/article_categories/{id}' do
|
|
get 'find article category by id' do
|
|
tags 'Category'
|
|
produces 'application/json'
|
|
id_url_param
|
|
|
|
response '200', 'article category found' do
|
|
schema type: :object, properties: {
|
|
article_categories: {
|
|
type: :array,
|
|
items: {
|
|
'$ref': '#/components/schemas/ArticleCategory'
|
|
}
|
|
}
|
|
}
|
|
let(:id) { create(:article_category, name: 'dairy').id }
|
|
run_test!
|
|
end
|
|
it_handles_invalid_token_with_id
|
|
it_cannot_find_object
|
|
end
|
|
end
|
|
end
|