mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #3775 from karevn/master
Please pull my changes - they fix a rare problem with tests framework
This commit is contained in:
commit
ad6f689bff
2 changed files with 16 additions and 2 deletions
|
@ -598,7 +598,8 @@ module ActionDispatch
|
||||||
params[key] = URI.parser.unescape(value)
|
params[key] = URI.parser.unescape(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
old_params = env[::ActionDispatch::Routing::RouteSet::PARAMETERS_KEY]
|
||||||
|
env[::ActionDispatch::Routing::RouteSet::PARAMETERS_KEY] = (old_params || {}).merge(params)
|
||||||
dispatcher = route.app
|
dispatcher = route.app
|
||||||
while dispatcher.is_a?(Mapper::Constraints) && dispatcher.matches?(env) do
|
while dispatcher.is_a?(Mapper::Constraints) && dispatcher.matches?(env) do
|
||||||
dispatcher = dispatcher.app
|
dispatcher = dispatcher.app
|
||||||
|
|
|
@ -1380,7 +1380,20 @@ class RouteSetTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
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
|
def test_route_requirement_recognize_with_ignore_case
|
||||||
set.draw do
|
set.draw do
|
||||||
match 'page/:name' => 'pages#show',
|
match 'page/:name' => 'pages#show',
|
||||||
|
|
Loading…
Reference in a new issue