Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show that rake oapi:fetch generates wrong output filename #869

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions spec/lib/oapi_tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ class Base < Grape::API
it 'returns swagger_doc.json' do
expect(subject.send(:file, docs_url)).to end_with 'swagger_doc.json'
end

context 'api has version' do
it 'returns versioned swagger_doc.json' do
expect(File.basename(subject.send(:file, docs_url))).to eq('swagger_doc_v1.json')
end
end
end

describe 'store given' do
Expand All @@ -148,6 +154,12 @@ class Base < Grape::API
it 'returns swagger_doc.json' do
expect(subject.send(:file, docs_url)).to end_with 'swagger_doc.json'
end

context 'api has version' do
it 'returns versioned swagger_doc.json' do
expect(File.basename(subject.send(:file, docs_url))).to eq('swagger_doc_v1.json')
end
end
end

describe 'name given' do
Expand All @@ -157,6 +169,12 @@ class Base < Grape::API
it 'returns swagger_doc.json' do
expect(subject.send(:file, docs_url)).to include(name.split('.')[0])
end

context 'api has version' do
it 'returns versioned oapi_doc.json' do
expect(File.basename(subject.send(:file, docs_url))).to eq('oapi_doc_v1.json')
end
end
end
end
end
Expand Down