Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Hard setting path_parameters in functional tests for monkey patching friendliness

#4745

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.

Reported by August Lilleaas · June 1st, 2010 @ 02:40 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. August Lilleaas
    August Lilleaas

    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.

    June 1st, 2010 @ 02:42 PM

  2. August Lilleaas
    August Lilleaas

    Updated the test to call something more testable that makes more sense.

    June 1st, 2010 @ 02:47 PM

  3. August Lilleaas
    August Lilleaas
    • Tag changed from actioncontroller, test to actioncontroller, rails3, test

    June 1st, 2010 @ 02:57 PM

  4. August Lilleaas
  5. Ryan Bigg
    Ryan Bigg
    • State changed from new to resolved

    June 7th, 2010 @ 09:08 AM