vendor/rails/actionpack/lib/action_controller/test_process.rb in radiant-0.6.3 vs vendor/rails/actionpack/lib/action_controller/test_process.rb in radiant-0.6.4
- old
+ new
@@ -22,10 +22,11 @@
class TestRequest < AbstractRequest #:nodoc:
attr_accessor :cookies, :session_options
attr_accessor :query_parameters, :request_parameters, :path, :session, :env
attr_accessor :host
+ attr_reader :request_uri_overridden
def initialize(query_parameters = nil, request_parameters = nil, session = nil)
@query_parameters = query_parameters || {}
@request_parameters = request_parameters || {}
@session = session || TestSession.new
@@ -65,16 +66,18 @@
end
# Used to check AbstractRequest's request_uri functionality.
# Disables the use of @path and @request_uri so superclass can handle those.
def set_REQUEST_URI(value)
+ @request_uri_overridden = true
@env["REQUEST_URI"] = value
@request_uri = nil
@path = nil
end
def request_uri=(uri)
+ @env["REQUEST_URI"] = uri
@request_uri = uri
@path = uri.split("?").first
end
def accept=(mime_types)
@@ -424,15 +427,15 @@
def redirect_to_url
@response.redirect_url
end
def build_request_uri(action, parameters)
- unless @request.env['REQUEST_URI']
+ unless @request.request_uri_overridden
options = @controller.send(:rewrite_options, parameters)
options.update(:only_path => true, :action => action)
url = ActionController::UrlRewriter.new(@request, parameters)
- @request.set_REQUEST_URI(url.rewrite(options))
+ @request.request_uri = url.rewrite(options)
end
end
def html_document
@html_document ||= HTML::Document.new(@response.body)