mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 15:22:56 +00:00
rename to rswag plus major refactor - almost a rewrite
This commit is contained in:
21
rswag-ui/spec/generators/rswag/ui/custom_generator_spec.rb
Normal file
21
rswag-ui/spec/generators/rswag/ui/custom_generator_spec.rb
Normal 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
|
||||
@@ -0,0 +1,2 @@
|
||||
TestApp::Application.routes.draw do
|
||||
end
|
||||
27
rswag-ui/spec/generators/rswag/ui/install_generator_spec.rb
Normal file
27
rswag-ui/spec/generators/rswag/ui/install_generator_spec.rb
Normal 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
|
||||
@@ -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
|
||||
4
rswag-ui/spec/generators/rswag/ui/tmp/config/routes.rb
Normal file
4
rswag-ui/spec/generators/rswag/ui/tmp/config/routes.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
TestApp::Application.routes.draw do
|
||||
mount Rswag::Ui::Engine => '/api-docs'
|
||||
|
||||
end
|
||||
0
rswag-ui/spec/spec_helper.rb
Normal file
0
rswag-ui/spec/spec_helper.rb
Normal file
Reference in New Issue
Block a user