Permalink
Browse files

adding integration test for journey #7

  • Loading branch information...
1 parent 79778ff commit d5ccb5cf653872917ae25f1977932a5efe2408aa @tenderlove tenderlove committed Dec 21, 2011
Showing with 22 additions and 0 deletions.
  1. +22 −0 actionpack/test/controller/routing_test.rb
@@ -81,6 +81,28 @@ def setup
@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

0 comments on commit d5ccb5c

Please sign in to comment.