aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorXavier Defrang <xavier.defrang@gmail.com>2013-06-28 15:37:26 +0200
committerXavier Defrang <xavier.defrang@gmail.com>2013-06-28 15:54:48 +0200
commit9fd0c605b9bcfb2c2e854f3120bd3625eaa017f5 (patch)
tree3c8daeba169acbb5da53caafb0b1e5ba93e97522 /actionpack/test/dispatch/routing_test.rb
parent55193e449a377c448e43d8fec42899ea1ff93b27 (diff)
downloadrails-9fd0c605b9bcfb2c2e854f3120bd3625eaa017f5.tar.gz
rails-9fd0c605b9bcfb2c2e854f3120bd3625eaa017f5.tar.bz2
rails-9fd0c605b9bcfb2c2e854f3120bd3625eaa017f5.zip
Verify that route constraints respond to the expected messages instead of silently failing to enforce the constraint
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 8e4339aa0c..e1ce3648e8 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -3593,6 +3593,21 @@ class TestFormatConstraints < ActionDispatch::IntegrationTest
end
end
+class TestCallableConstraintValidation < ActionDispatch::IntegrationTest
+
+ def test_constraint_with_object_not_callable
+ assert_raise(ArgumentError) do
+ ActionDispatch::Routing::RouteSet.new.tap do |app|
+ app.draw do
+ ok = lambda { |env| [200, { 'Content-Type' => 'text/plain' }, []] }
+ get '/test', to: ok, constraints: Object.new
+ end
+ end
+ end
+ end
+
+end
+
class TestRouteDefaults < ActionDispatch::IntegrationTest
stub_controllers do |routes|
Routes = routes