diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-03-02 18:57:02 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-03-03 21:23:34 -0800 |
commit | 5e0a05b8cb236d285ebb45de006dd3600c69357d (patch) | |
tree | 8fd61eaaa83407c6880bd94c9c3d662cf5c28a84 /actionpack/lib/action_controller/test_case.rb | |
parent | bcfb77782b9d7f28f0c19005da909162e5e27690 (diff) | |
download | rails-5e0a05b8cb236d285ebb45de006dd3600c69357d.tar.gz rails-5e0a05b8cb236d285ebb45de006dd3600c69357d.tar.bz2 rails-5e0a05b8cb236d285ebb45de006dd3600c69357d.zip |
Tweak the semantic of various URL related methods of ActionDispatch::Request
Diffstat (limited to 'actionpack/lib/action_controller/test_case.rb')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 22 |
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 |