aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-21 11:45:41 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-21 13:56:20 -0700
commit44ff03bb2eb1eb2b088265389a2adc89936d7099 (patch)
tree42e93cb8d3e60f608155213665b378f91b7e892f /actionpack
parentd6d774063da02f0654f9203c8bface943e889454 (diff)
downloadrails-44ff03bb2eb1eb2b088265389a2adc89936d7099.tar.gz
rails-44ff03bb2eb1eb2b088265389a2adc89936d7099.tar.bz2
rails-44ff03bb2eb1eb2b088265389a2adc89936d7099.zip
adding integration test for journey #7
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/controller/routing_test.rb22
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