Functional tests with multiple requests are concatenating parameters on 2.3.2

Hey guys,

I just ran into a situation where this test started failing after upgrading to 2.3.2 from 2.2.2:

xhr :post, :signin, :email => “ryan@angilly.com”, :password => “correct”

assert_template “signin/link”

xhr :post, :signin, :email => “ryan@angilly.com” assert_template “signin/index”

The second assert is failing. Instead of rendering the index template, it’s rendering the link template again. After a bit of debugging, I saw that the second request has :password => “correct” being passed in as a parameter.

I tracked it down to action_controller/request.rb:

420 # Override Rack’s GET method to support indifferent access 421 def GET 422 @env[“action_controller.request.query_parameters”] ||= normalize_parameters(super) 423 end 424 alias_method :query_parameters, :GET 425 426 # Override Rack’s POST method to support indifferent access 427 def POST 428 @env[“action_controller.request.request_parameters”] ||= normalize_parameters(super) 429 end 430 alias_method :request_parameters, :POST

In action_controller/test_process.rb, there are several places where we try to clean up the current request by setting @parameters to nil, but this ignores the fact that request_parameters no longer relies on @parameters. It’s now duping @env[“action_controller.request.request_parameters”]

So I’m thinking test_process needs a ‘clear_parameters’ method:

def clear_parameters @request.env.delete(‘action_controller.request.request_parameters’) @request.env.delete(‘action_controller.request.query_parameters’) end

And that this method should be called in place of @parameters = nil

This is my first foray into the world of Rack, so I could be way off base here. Thoughts?

Thanks, Ryan