Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always use ActionDispatch::ShowExceptions middleware [#6462 state:res…
…olved] This will make sure the application will raise `ActionController::RoutingError` in case "X-Cascade: pass" header was set, usually when there's no route match.
- Loading branch information
1 parent
439a745
commit 515ea95
Showing
3 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
railties/test/application/middleware/show_exceptions_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
require 'isolation/abstract_unit' | |||
|
|||
module ApplicationTests | |||
class ShowExceptionsTest < Test::Unit::TestCase | |||
include ActiveSupport::Testing::Isolation | |||
|
|||
def setup | |||
build_app | |||
boot_rails | |||
FileUtils.rm_rf "#{app_path}/config/environments" | |||
end | |||
|
|||
def app | |||
@app ||= Rails.application | |||
end | |||
|
|||
test "unspecified route when set action_dispatch.show_exceptions to false" do | |||
make_basic_app do |app| | |||
app.config.action_dispatch.show_exceptions = false | |||
end | |||
|
|||
assert_raise(ActionController::RoutingError) do | |||
get '/foo' | |||
end | |||
end | |||
|
|||
test "unspecified route when set action_dispatch.show_exceptions to true" do | |||
make_basic_app do |app| | |||
app.config.action_dispatch.show_exceptions = true | |||
end | |||
|
|||
assert_nothing_raised(ActionController::RoutingError) do | |||
get '/foo' | |||
end | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters