This project is archived and is in readonly mode.
Hard setting path_parameters in functional tests for monkey patching friendliness
Reported by August Lilleaas | June 1st, 2010 @ 02:40 PM
ActionController::TestRequest#assign_parameters
should hard set path_parameters
. This is so that
monkey patchers can safely override methods and use
params
(or it's alias parameters
) without
breaking functional tests.
Because of
the way parameters is implemented, as soon as it is called,
altering the contents of path_parameters
has no effect
on parameters
.
The current behavior is to alter path_parameters
,
which will not as intended alter what parameters
returns, since it has already been set.
The issue is resolved by explicitly calling
path_parameters=
.
See attached patch, with test case and fix.
Comments and changes to this ticket
-
August Lilleaas June 1st, 2010 @ 02:42 PM
Note: here is the real world monkey patch that caused this issue. http://gitorious.org/~augustl/gitorious/augustls-clone/commit/05206...
You can argue that the problem here is the horribly old plugin, and monkey patching in general :) But the change is pretty minor, and it makes sense to tighten up the implementation like this anyways.
-
August Lilleaas June 1st, 2010 @ 02:47 PM
Updated the test to call something more testable that makes more sense.
-
August Lilleaas June 1st, 2010 @ 02:57 PM
- Tag changed from actioncontroller, test to actioncontroller, rails3, test
-
Ryan Bigg June 7th, 2010 @ 09:08 AM
- State changed from new to resolved
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>