aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
authorkarevn <karev.n@gmail.com>2011-11-28 00:55:50 +0600
committerkarevn <karev.n@gmail.com>2011-11-28 00:55:50 +0600
commit9b654d47134ef06022861200c2f6e48f8459afb0 (patch)
tree6e4560aa505df84af408bba0e69a665a0ce21bc3 /actionpack/test/controller/routing_test.rb
parent71b387d91e7d74ad3b90db7b9b9264936d6d3c4d (diff)
downloadrails-9b654d47134ef06022861200c2f6e48f8459afb0.tar.gz
rails-9b654d47134ef06022861200c2f6e48f8459afb0.tar.bz2
rails-9b654d47134ef06022861200c2f6e48f8459afb0.zip
Fix: when using subdomains and constraints, request params were not passed to constraints callback
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-rw-r--r--actionpack/test/controller/routing_test.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 5bf68decca..a6abc5f1b7 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -1258,7 +1258,20 @@ class RouteSetTest < ActiveSupport::TestCase
end
end
end
-
+
+ def test_route_with_subdomain_and_constraints_must_receive_params
+ name_param = nil
+ set.draw do
+ match 'page/:name' => 'pages#show', :constraints => lambda {|request|
+ name_param = request.params[:name]
+ return true
+ }
+ end
+ assert_equal({:controller => 'pages', :action => 'show', :name => 'mypage'},
+ set.recognize_path('http://subdomain.example.org/page/mypage'))
+ assert_equal(name_param, 'mypage')
+ end
+
def test_route_requirement_recognize_with_ignore_case
set.draw do
match 'page/:name' => 'pages#show',