aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-14 09:19:22 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-14 10:39:32 -0700
commit715abbbb33a0715b5b8476132b7fd7c20b9e0df1 (patch)
tree7566dbc30ea6a23b6525b027cd98877912f95205 /actionpack
parent1eb6b4a679b05e443792430f11f084746005f6ff (diff)
downloadrails-715abbbb33a0715b5b8476132b7fd7c20b9e0df1.tar.gz
rails-715abbbb33a0715b5b8476132b7fd7c20b9e0df1.tar.bz2
rails-715abbbb33a0715b5b8476132b7fd7c20b9e0df1.zip
stop adding path_info to the conditions hash
we don't need to keep adding it and deleting if from hashes.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb1
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb1
-rw-r--r--actionpack/test/dispatch/mapper_test.rb18
3 files changed, 9 insertions, 11 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 8a90c40d2b..51d4ebb5c4 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -135,7 +135,6 @@ module ActionDispatch
@defaults = formats[:defaults].merge(@defaults).merge(normalize_defaults(options))
@conditions[:required_defaults] = (split_options[:required_defaults] || []).map(&:first)
- @conditions[:path_info] = path
@conditions[:parsed_path_info] = ast
unless via == [:all]
@conditions[:request_method] = via.map { |m| m.to_s.dasherize.upcase }
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 279cbd232b..a3cadec68f 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -525,7 +525,6 @@ module ActionDispatch
"http://guides.rubyonrails.org/routing.html#restricting-the-routes-created"
end
- path = conditions.delete :path_info
ast = conditions.delete :parsed_path_info
required_defaults = conditions.delete :required_defaults
path = build_path(ast, requirements, anchor)
diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb
index 7ba946aa7f..10ef00ca50 100644
--- a/actionpack/test/dispatch/mapper_test.rb
+++ b/actionpack/test/dispatch/mapper_test.rb
@@ -67,7 +67,7 @@ module ActionDispatch
mapper.get '/foo', :to => 'posts#index', :as => :main, :format => true
assert_equal({:controller=>"posts", :action=>"index"},
fakeset.defaults.first)
- assert_equal "/foo.:format", fakeset.conditions.first[:path_info]
+ assert_equal "/foo.:format", fakeset.conditions.first[:parsed_path_info].to_s
end
def test_scoped_formatted
@@ -78,7 +78,7 @@ module ActionDispatch
end
assert_equal({:controller=>"posts", :action=>"index"},
fakeset.defaults.first)
- assert_equal "/foo.:format", fakeset.conditions.first[:path_info]
+ assert_equal "/foo.:format", fakeset.conditions.first[:parsed_path_info].to_s
end
def test_random_keys
@@ -113,7 +113,7 @@ module ActionDispatch
fakeset = FakeSet.new
mapper = Mapper.new fakeset
mapper.get '/', :to => 'posts#index', :as => :main
- assert_equal '/', fakeset.conditions.first[:path_info]
+ assert_equal '/', fakeset.conditions.first[:parsed_path_info].to_s
end
def test_map_more_slashes
@@ -122,14 +122,14 @@ module ActionDispatch
# FIXME: is this a desired behavior?
mapper.get '/one/two/', :to => 'posts#index', :as => :main
- assert_equal '/one/two(.:format)', fakeset.conditions.first[:path_info]
+ assert_equal '/one/two(.:format)', fakeset.conditions.first[:parsed_path_info].to_s
end
def test_map_wildcard
fakeset = FakeSet.new
mapper = Mapper.new fakeset
mapper.get '/*path', :to => 'pages#show'
- assert_equal '/*path(.:format)', fakeset.conditions.first[:path_info]
+ assert_equal '/*path(.:format)', fakeset.conditions.first[:parsed_path_info].to_s
assert_equal(/.+?/, fakeset.requirements.first[:path])
end
@@ -137,7 +137,7 @@ module ActionDispatch
fakeset = FakeSet.new
mapper = Mapper.new fakeset
mapper.get '/*path/foo/:bar', :to => 'pages#show'
- assert_equal '/*path/foo/:bar(.:format)', fakeset.conditions.first[:path_info]
+ assert_equal '/*path/foo/:bar(.:format)', fakeset.conditions.first[:parsed_path_info].to_s
assert_equal(/.+?/, fakeset.requirements.first[:path])
end
@@ -145,7 +145,7 @@ module ActionDispatch
fakeset = FakeSet.new
mapper = Mapper.new fakeset
mapper.get '/*foo/*bar', :to => 'pages#show'
- assert_equal '/*foo/*bar(.:format)', fakeset.conditions.first[:path_info]
+ assert_equal '/*foo/*bar(.:format)', fakeset.conditions.first[:parsed_path_info].to_s
assert_equal(/.+?/, fakeset.requirements.first[:foo])
assert_equal(/.+?/, fakeset.requirements.first[:bar])
end
@@ -154,7 +154,7 @@ module ActionDispatch
fakeset = FakeSet.new
mapper = Mapper.new fakeset
mapper.get '/*path', :to => 'pages#show', :format => false
- assert_equal '/*path', fakeset.conditions.first[:path_info]
+ assert_equal '/*path', fakeset.conditions.first[:parsed_path_info].to_s
assert_nil fakeset.requirements.first[:path]
end
@@ -162,7 +162,7 @@ module ActionDispatch
fakeset = FakeSet.new
mapper = Mapper.new fakeset
mapper.get '/*path', :to => 'pages#show', :format => true
- assert_equal '/*path.:format', fakeset.conditions.first[:path_info]
+ assert_equal '/*path.:format', fakeset.conditions.first[:parsed_path_info].to_s
end
def test_raising_helpful_error_on_invalid_arguments