Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move TestRequest#query_parameters into AD TestRequest

  • Loading branch information...
commit 1fcc7dbcc8dcf7f1d42ca8486ad313f0c805033a 1 parent dc9f53b
@josh josh authored
View
14 actionpack/lib/action_controller/testing/process.rb
@@ -2,20 +2,13 @@
module ActionController #:nodoc:
class TestRequest < ActionDispatch::TestRequest #:nodoc:
- attr_accessor :query_parameters
-
def initialize(env = {})
super
- @query_parameters = {}
self.session = TestSession.new
self.session_options = TestSession::DEFAULT_OPTIONS.merge(:id => ActiveSupport::SecureRandom.hex(16))
end
- def action=(action_name)
- query_parameters.update({ "action" => action_name })
- end
-
def assign_parameters(controller_path, action, parameters)
parameters = parameters.symbolize_keys.merge(:controller => controller_path, :action => action)
extra_keys = ActionController::Routing::Routes.extra_keys(parameters)
@@ -47,9 +40,8 @@ def assign_parameters(controller_path, action, parameters)
end
def recycle!
- @env.delete_if { |k, v| k =~ /^action_dispatch\.request/ }
- self.query_parameters = {}
- @headers = nil
+ @env.delete_if { |k, v| k =~ /^(action_dispatch|rack)\.request/ }
+ @env['action_dispatch.request.query_parameters'] = {}
end
end
@@ -132,8 +124,6 @@ def process(action, parameters = nil, session = nil, flash = nil, http_method =
@html_document = nil
@request.request_method = http_method
- @request.action = action.to_s
-
parameters ||= {}
@request.assign_parameters(@controller.class.controller_path, action.to_s, parameters)
View
2  actionpack/lib/action_dispatch/http/request.rb
@@ -351,7 +351,7 @@ def subdomains(tld_length = 1)
# Returns the query string, accounting for server idiosyncrasies.
def query_string
- @env['QUERY_STRING'].present? ? @env['QUERY_STRING'] : (@env['REQUEST_URI'].split('?', 2)[1] || '')
+ @env['QUERY_STRING'].present? ? @env['QUERY_STRING'] : (@env['REQUEST_URI'].to_s.split('?', 2)[1] || '')
end
# Returns the request URI, accounting for server idiosyncrasies.
View
4 actionpack/lib/action_dispatch/testing/test_request.rb
@@ -39,6 +39,10 @@ def path=(path)
@env['PATH_INFO'] = path
end
+ def action=(action_name)
+ path_parameters["action"] = action_name.to_s
+ end
+
def if_modified_since=(last_modified)
@env['HTTP_IF_MODIFIED_SINCE'] = last_modified
end
Please sign in to comment.
Something went wrong with that request. Please try again.