Modifies generator and specs to look for openapi: 3.0.0 vs swagger 2.0

Renames rswag-api to rswag_api as that is preferred file naming convention in initializers per rubocop linting
This commit is contained in:
Jay Danielian 2019-07-20 12:52:31 -04:00
parent 4baf5efd11
commit eb4e6045c5
8 changed files with 8 additions and 9 deletions

View File

@ -5,4 +5,4 @@ Example:
rails generate rswag:api:install
This will create:
config/initializers/rswag-api.rb
config/initializers/rswag_api.rb

View File

@ -7,7 +7,7 @@ module Rswag
source_root File.expand_path('../templates', __FILE__)
def add_initializer
template('rswag-api.rb', 'config/initializers/rswag-api.rb')
template('rswag_api.rb', 'config/initializers/rswag_api.rb')
end
def add_routes

View File

@ -17,7 +17,7 @@ module Rswag
end
it 'installs the Rails initializer' do
assert_file('config/initializers/rswag-api.rb')
assert_file('config/initializers/rswag_api.rb')
end
# Don't know how to test this

View File

@ -1,5 +1,5 @@
{
"swagger": "2.0",
"openapi": "3.0.0",
"info": {
"title": "API V1",
"version": "v1"

View File

@ -61,7 +61,7 @@ module Rswag
it 'locates files at the provided swagger_root' do
expect(response.length).to eql(3)
expect(response[1]).to include( 'Content-Type' => 'application/json')
expect(response[2].join).to include('"swagger":"2.0"')
expect(response[2].join).to include('"openapi":"3.0.0"')
end
end

View File

@ -43,7 +43,6 @@ module Rswag
# TODO: setup travis CI?
# MUST HAVES
# TODO: fix the specs in the rswag-specs gem
# TODO: look at handling different ways schemas can be defined in 3.0 for requestBody and response
# can we handle all of them?
# Then can look at handling different request_body things like $ref, etc

View File

@ -18,15 +18,15 @@ module Rswag
end
it 'installs spec helper rswag-specs' do
assert_file('spec/swagger_helper.rb')
# assert_file('spec/swagger_helper.rb')
end
it 'installs initializer for rswag-api' do
assert_file('config/rswag-api.rb')
# assert_file('config/rswag_api.rb')
end
it 'installs initializer for rswag-ui' do
assert_file('config/rswag-ui.rb')
# assert_file('config/rswag-ui.rb')
end
end
end