mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 07:16:40 +00:00
Support mount-specific swagger_root and add swagger_filter setting
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
require 'rails_helper'
|
||||
require 'generators/swagger_rails/custom_ui/custom_ui_generator'
|
||||
|
||||
describe SwaggerRails::CustomUiGenerator do
|
||||
include GeneratorSpec::TestCase
|
||||
destination File.expand_path('../tmp', __FILE__)
|
||||
module SwaggerRails
|
||||
|
||||
before(:all) do
|
||||
prepare_destination
|
||||
run_generator
|
||||
end
|
||||
describe CustomUiGenerator do
|
||||
include GeneratorSpec::TestCase
|
||||
destination File.expand_path('../tmp', __FILE__)
|
||||
|
||||
it 'creates a local version of index.html.erb' do
|
||||
assert_file('app/views/swagger_rails/swagger_ui/index.html.erb')
|
||||
before(:all) do
|
||||
prepare_destination
|
||||
run_generator
|
||||
end
|
||||
|
||||
it 'creates a local version of index.html.erb' do
|
||||
assert_file('app/views/swagger_rails/swagger_ui/index.html.erb')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
2
spec/generators/swagger_rails/fixtures/config/routes.rb
Normal file
2
spec/generators/swagger_rails/fixtures/config/routes.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
Rails.application.routes.draw do
|
||||
end
|
||||
@@ -1,26 +1,34 @@
|
||||
require 'rails_helper'
|
||||
require 'generators/swagger_rails/install/install_generator'
|
||||
|
||||
describe SwaggerRails::InstallGenerator do
|
||||
include GeneratorSpec::TestCase
|
||||
destination File.expand_path('../tmp', __FILE__)
|
||||
module SwaggerRails
|
||||
|
||||
before(:all) do
|
||||
prepare_destination
|
||||
config_dir = File.expand_path('../../fixtures/config', __FILE__)
|
||||
FileUtils.cp_r(config_dir, destination_root)
|
||||
describe InstallGenerator do
|
||||
include GeneratorSpec::TestCase
|
||||
destination File.expand_path('../tmp', __FILE__)
|
||||
|
||||
run_generator
|
||||
before(:all) do
|
||||
prepare_destination
|
||||
fixtures_dir = File.expand_path('../fixtures', __FILE__)
|
||||
FileUtils.cp_r("#{fixtures_dir}/config", destination_root)
|
||||
FileUtils.cp_r("#{fixtures_dir}/spec", destination_root)
|
||||
|
||||
run_generator
|
||||
end
|
||||
|
||||
it 'creates a default swagger directory' do
|
||||
assert_directory('swagger/v1')
|
||||
end
|
||||
|
||||
it 'installs swagger_rails initializer' do
|
||||
assert_file('config/initializers/swagger_rails.rb')
|
||||
end
|
||||
|
||||
it 'installs the swagger_helper for rspec' do
|
||||
assert_file('spec/swagger_helper.rb')
|
||||
end
|
||||
|
||||
it 'wires up the swagger routes'
|
||||
# Not sure how to test this
|
||||
end
|
||||
|
||||
it 'creates a default swagger directory' do
|
||||
assert_directory('swagger/v1')
|
||||
end
|
||||
|
||||
it 'creates a swagger_rails initializer' do
|
||||
assert_file('config/initializers/swagger_rails.rb')
|
||||
end
|
||||
|
||||
it 'wires up the swagger routes'
|
||||
# Not sure how to test this
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user