rename to rswag plus major refactor - almost a rewrite

This commit is contained in:
richie
2016-10-11 18:31:12 -07:00
parent f8d993356f
commit c558098c39
453 changed files with 52410 additions and 35793 deletions

View File

@@ -0,0 +1,21 @@
require 'generator_spec'
require 'generators/rswag/ui/custom/custom_generator'
module Rswag
module Ui
describe CustomGenerator do
include GeneratorSpec::TestCase
destination File.expand_path('../tmp', __FILE__)
before(:all) do
prepare_destination
run_generator
end
it 'creates a local version of index.html.erb' do
assert_file('app/views/rswag/ui/home/index.html.erb')
end
end
end
end

View File

@@ -0,0 +1,2 @@
TestApp::Application.routes.draw do
end

View File

@@ -0,0 +1,27 @@
require 'generator_spec'
require 'generators/rswag/ui/install/install_generator'
module Rswag
module Ui
describe InstallGenerator do
include GeneratorSpec::TestCase
destination File.expand_path('../tmp', __FILE__)
before(:all) do
prepare_destination
fixtures_dir = File.expand_path('../fixtures', __FILE__)
FileUtils.cp_r("#{fixtures_dir}/config", destination_root)
run_generator
end
it 'installs the Rails initializer' do
assert_file('config/initializers/rswag-ui.rb')
end
# Don't know how to test this
#it 'wires up routes'
end
end
end

View File

@@ -0,0 +1,9 @@
Rswag::Ui.configure do |c|
# List the Swagger endpoints that you want to be documented through the swagger-ui
# The first parameter is the path (absolute or relative to the UI host) to the corresponding
# JSON endpoint and the second is a title that will be displayed in the document selector
# NOTE: If you're using rspec-api to expose Swagger files (under swagger_root) as JSON endpoints,
# then the list below should correspond to the relative paths for those endpoints
c.swagger_endpoint '/api-docs/v1/swagger.json', 'API V1 Docs'
end

View File

@@ -0,0 +1,4 @@
TestApp::Application.routes.draw do
mount Rswag::Ui::Engine => '/api-docs'
end