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