diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-12-14 10:17:42 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-12-14 10:17:42 -0700 |
commit | 1dc1c8e40bff1c6ba5fcbec4f325ae6c043e6404 (patch) | |
tree | 34eccfd8e5055476a01117364c90d6c55e174db6 /actionpack/test | |
parent | 4ecabed2f65cc899ed2e8858fb1140bca8531ff8 (diff) | |
parent | d3dd3847bc2633ecead36f602bfca21c9362b502 (diff) | |
download | rails-1dc1c8e40bff1c6ba5fcbec4f325ae6c043e6404.tar.gz rails-1dc1c8e40bff1c6ba5fcbec4f325ae6c043e6404.tar.bz2 rails-1dc1c8e40bff1c6ba5fcbec4f325ae6c043e6404.zip |
Merge pull request #22564 from maximeg/legit_name_errors
Don't catch all NameError to reraise as ActionController::RoutingError
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 8972f3e74d..82222a141c 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -4592,3 +4592,44 @@ class TestDefaultUrlOptions < ActionDispatch::IntegrationTest assert_equal '/en/posts/2014/12/13', archived_posts_path(2014, 12, 13) end end + +class TestErrorsInController < ActionDispatch::IntegrationTest + class ::PostsController < ActionController::Base + def foo + nil.i_do_not_exist + end + + def bar + NonExistingClass.new + end + end + + Routes = ActionDispatch::Routing::RouteSet.new + Routes.draw do + get '/:controller(/:action)' + end + + APP = build_app Routes + + def app + APP + end + + def test_legit_no_method_errors_are_not_caught + get '/posts/foo' + assert_equal 500, response.status + end + + def test_legit_name_errors_are_not_caught + get '/posts/bar' + assert_equal 500, response.status + end + + def test_legit_routing_not_found_responses + get '/posts/baz' + assert_equal 404, response.status + + get '/i_do_not_exist' + assert_equal 404, response.status + end +end |