aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/test_case.rb
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-03-03 22:35:43 -0800
committerCarl Lerche <carllerche@mac.com>2010-03-03 22:35:43 -0800
commit5ce25aecee062c11fc0186ae2df625ba3f013a46 (patch)
tree2c0dc0f69d4ff0dc182cc9f32d59d85257a6723b /actionpack/lib/action_controller/test_case.rb
parent2a60cc682224f8a0923de1e0bf769d5333084480 (diff)
parent13a932cddcd3165792d3454009b6d07471031a2c (diff)
downloadrails-5ce25aecee062c11fc0186ae2df625ba3f013a46.tar.gz
rails-5ce25aecee062c11fc0186ae2df625ba3f013a46.tar.bz2
rails-5ce25aecee062c11fc0186ae2df625ba3f013a46.zip
Merge branch 'configuration_refactor'
Diffstat (limited to 'actionpack/lib/action_controller/test_case.rb')
-rw-r--r--actionpack/lib/action_controller/test_case.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 64d9bdab2a..7e0a833dfa 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -322,6 +322,8 @@ module ActionController
@controller ||= klass.new rescue nil
end
+ @request.env.delete('PATH_INFO')
+
if @controller
@controller.request = @request
@controller.params = {}
@@ -333,15 +335,19 @@ module ActionController
@request.remote_addr = '208.77.188.166' # example.com
end
- private
- def build_request_uri(action, parameters)
- unless @request.env['REQUEST_URI']
- options = @controller.__send__(:url_options).merge(parameters)
- options.update(:only_path => true, :action => action)
+ private
+ def build_request_uri(action, parameters)
+ unless @request.env["PATH_INFO"]
+ options = @controller.__send__(:url_options).merge(parameters)
+ options.update(:only_path => true, :action => action, :relative_url_root => nil)
+ rewriter = ActionController::UrlRewriter.new(@request, parameters)
- url = ActionController::UrlRewriter.new(@request, parameters)
- @request.request_uri = url.rewrite(@router, options)
- end
+ url, query_string = rewriter.rewrite(@router, options).split("?", 2)
+
+ @request.env["SCRIPT_NAME"] = @controller.config.relative_url_root
+ @request.env["PATH_INFO"] = url
+ @request.env["QUERY_STRING"] = query_string || ""
end
+ end
end
end