diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-21 11:45:41 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-12-21 11:46:59 -0700 |
commit | d5ccb5cf653872917ae25f1977932a5efe2408aa (patch) | |
tree | f6960a73df956018c7f69c184b6a488e388c8378 | |
parent | 79778ffac5fe11ee92dbed526273973098e8f813 (diff) | |
download | rails-d5ccb5cf653872917ae25f1977932a5efe2408aa.tar.gz rails-d5ccb5cf653872917ae25f1977932a5efe2408aa.tar.bz2 rails-d5ccb5cf653872917ae25f1977932a5efe2408aa.zip |
adding integration test for journey #7
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index a60da65ae5..a931222bbc 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -81,6 +81,28 @@ class LegacyRouteSetTests < Test::Unit::TestCase @rs = ::ActionDispatch::Routing::RouteSet.new end + def test_regexp_precidence + @rs.draw do + match '/whois/:domain', :constraints => { + :domain => /\w+\.[\w\.]+/ }, + :to => lambda { |env| [200, {}, 'regexp'] } + + match '/whois/:id', :to => lambda { |env| [200, {}, 'id'] } + end + + body = @rs.call({'PATH_INFO' => '/whois/example.org', + 'REQUEST_METHOD' => 'GET', + 'HTTP_HOST' => 'www.example.org'})[2] + + assert_equal 'regexp', body + + body = @rs.call({'PATH_INFO' => '/whois/123', + 'REQUEST_METHOD' => 'GET', + 'HTTP_HOST' => 'clients.example.org'})[2] + + assert_equal 'id', body + end + def test_class_and_lambda_constraints subdomain = Class.new { def matches? request |