diff options
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 6ba52e37b6..c01065932a 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -364,18 +364,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end def test_pagemarks - tc = self draw do scope "pagemark", controller: "pagemarks", as: :pagemark do - tc.assert_deprecated do - get "new", path: "build" - end + get "build", action: "new", as: "new" post "create", as: "" put "update" get "remove", action: :destroy, as: :remove - tc.assert_deprecated do - get action: :show, as: :show - end + get "", action: :show, as: :show end end @@ -4684,22 +4679,25 @@ class TestUrlGenerationErrors < ActionDispatch::IntegrationTest include Routes.url_helpers - test "url helpers raise a helpful error message when generation fails" do + test "url helpers raise a 'missing keys' error for a nil param with optimized helpers" do url, missing = { action: "show", controller: "products", id: nil }, [:id] - message = "No route matches #{url.inspect} missing required keys: #{missing.inspect}" + message = "No route matches #{url.inspect}, missing required keys: #{missing.inspect}" - # Optimized url helper error = assert_raises(ActionController::UrlGenerationError) { product_path(nil) } assert_equal message, error.message + end + + test "url helpers raise a 'constraint failure' error for a nil param with non-optimized helpers" do + url, missing = { action: "show", controller: "products", id: nil }, [:id] + message = "No route matches #{url.inspect}, possible unmatched constraints: #{missing.inspect}" - # Non-optimized url helper error = assert_raises(ActionController::UrlGenerationError, message) { product_path(id: nil) } assert_equal message, error.message end - test "url helpers raise message with mixed parameters when generation fails " do + test "url helpers raise message with mixed parameters when generation fails" do url, missing = { action: "show", controller: "products", id: nil, "id"=>"url-tested" }, [:id] - message = "No route matches #{url.inspect} missing required keys: #{missing.inspect}" + message = "No route matches #{url.inspect}, possible unmatched constraints: #{missing.inspect}" # Optimized url helper error = assert_raises(ActionController::UrlGenerationError) { product_path(nil, "id"=>"url-tested") } |