1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Make process reuse the env var passed as argument"

This reverts commit 0e4748cd41.
This commit is contained in:
Santiago Pastorino 2011-09-24 01:34:49 -03:00
parent e69011521d
commit 3de95fd930
2 changed files with 9 additions and 10 deletions

View file

@ -241,8 +241,8 @@ module ActionDispatch
end
# Performs the actual request.
def process(method, path, parameters = nil, env = nil)
env ||= {}
def process(method, path, parameters = nil, rack_env = nil)
rack_env ||= {}
if path =~ %r{://}
location = URI.parse(path)
https! URI::HTTPS === location if location.scheme
@ -258,7 +258,7 @@ module ActionDispatch
hostname, port = host.split(':')
default_env = {
env = {
:method => method,
:params => parameters,
@ -276,7 +276,7 @@ module ActionDispatch
session = Rack::Test::Session.new(_mock_session)
env.reverse_merge!(default_env)
env.merge!(rack_env)
# NOTE: rack-test v0.5 doesn't build a default uri correctly
# Make sure requested path is always a full uri

View file

@ -493,7 +493,7 @@ class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
routes.draw do
match '', :to => 'application_integration_test/test#index', :as => :empty_string
match 'foo', :to => 'application_integration_test/test#index', :as => :foo
match 'bar', :to => 'application_integration_test/test#index', :as => :bar
end
@ -511,7 +511,7 @@ class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
test "route helpers after controller access" do
get '/'
assert_equal '/', empty_string_path
get '/foo'
assert_equal '/foo', foo_path
@ -528,11 +528,10 @@ class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
assert_raise(NameError) { missing_path }
end
test "process reuse the env we pass as argument" do
test "process do not modify the env passed as argument" do
env = { :SERVER_NAME => 'server', 'action_dispatch.custom' => 'custom' }
old_env = env.dup
get '/foo', nil, env
assert_equal :get, env[:method]
assert_equal 'server', env[:SERVER_NAME]
assert_equal 'custom', env['action_dispatch.custom']
assert_equal old_env, env
end
end