mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 15:22:56 +00:00
feature remove trailing produces and consumes
This commit is contained in:
@@ -174,17 +174,19 @@ module Rswag
|
||||
before do
|
||||
FileUtils.rm_r(swagger_root) if File.exist?(swagger_root)
|
||||
allow(config).to receive(:swagger_docs).and_return(
|
||||
'v1/swagger.json' => { info: { version: 'v1' } },
|
||||
'v2/swagger.json' => { info: { version: 'v2' } }
|
||||
'v1/swagger.json' => doc_1,
|
||||
'v2/swagger.json' => doc_2
|
||||
)
|
||||
allow(config).to receive(:swagger_format).and_return(swagger_format)
|
||||
subject.stop(notification)
|
||||
end
|
||||
|
||||
let(:doc_1) { { info: { version: 'v1' } } }
|
||||
let(:doc_2) { { info: { version: 'v2' } } }
|
||||
let(:swagger_format) { :json }
|
||||
|
||||
let(:notification) { double('notification') }
|
||||
context 'with default format' do
|
||||
let(:swagger_format) { :json }
|
||||
|
||||
it 'writes the swagger_doc(s) to file' do
|
||||
expect(File).to exist("#{swagger_root}/v1/swagger.json")
|
||||
expect(File).to exist("#{swagger_root}/v2/swagger.json")
|
||||
@@ -203,6 +205,24 @@ module Rswag
|
||||
end
|
||||
end
|
||||
|
||||
context 'with oauth3 upgrades' do
|
||||
let(:doc_2) do
|
||||
{ paths: { '/paths/{path_id}/nested_paths' => { get: {
|
||||
summary: 'Retrieve Nested Paths',
|
||||
tags: ['nested Paths'],
|
||||
produces: ['application/json'],
|
||||
consumes: ['application/xml']
|
||||
} } } }
|
||||
end
|
||||
|
||||
it 'removes remaining consumes/produces' do
|
||||
expect(doc_2).to eql({ paths: { '/paths/{path_id}/nested_paths' => { get: {
|
||||
summary: 'Retrieve Nested Paths',
|
||||
tags: ['nested Paths']
|
||||
} } } })
|
||||
end
|
||||
end
|
||||
|
||||
after do
|
||||
FileUtils.rm_r(swagger_root) if File.exist?(swagger_root)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user