Skip to content

Commit

Permalink
Test configurable options
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuzanna Stolińska committed Apr 18, 2017
1 parent 3b35d96 commit 83967c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/controllers/swagger_ui_engine/docs_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,18 @@ class DocsControllerTest < ActionDispatch::IntegrationTest
assert_response :success
assert_select '#swagger-ui-container'
end

test 'custom config options should work successfully' do
get '/swagger'
assert_match('url = "api_docs/swagger.yaml"', @response.body)
assert_match('docExpansion: "list"', @response.body)
assert_match('defaultModelRendering: "model"', @response.body)
end

test 'default config options should work successfully' do
get '/swagger'
assert_match('showRequestHeaders: "false"', @response.body)
assert_match('jsonEditor: "false"', @response.body)
end
end
end
2 changes: 2 additions & 0 deletions test/dummy/config/initializers/swagger_ui_engine.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SwaggerUiEngine.configure do |config|
config.swagger_url = 'api_docs/swagger.yaml'
config.doc_expansion = 'list'
config.model_rendering = 'model'
end

0 comments on commit 83967c2

Please sign in to comment.