Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #1204 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] assert_redirected_to fails with :only_path => false

Reported by: Alisdair McDiarmid <alisdair@randomoracle.org> Assigned to: David
Priority: normal Milestone:
Component: ActionPack Version: 0.12.1
Severity: normal Keywords: assert_redirected_to only_path
Cc:

Description

Using assert_redirected_to with :only_path => false always fails the test, due to a bug in the assertion. The code is equivalent to assert expected[k] == got[k] if got[k], when it should be assert expected[k] == got[k] unless got[k].nil?. Otherwise, URL options with value false will never be tested.

To be attached: unit test which fails with current trunk code, and a patch to make the test pass.

Attachments

assert-redirected-to-only-path-test.diff (0.8 kB) - added by Alisdair McDiarmid <alisdair@randomoracle.org> on 04/27/05 02:32:16.
Test case for assert_redirect_to with :only_path => false
assert-redirected-to-only-path-fix.diff (0.7 kB) - added by Alisdair McDiarmid <alisdair@randomoracle.org> on 04/27/05 02:32:28.
Fix for assert_redirect_to with :only_path => false

Change History

04/27/05 02:32:16 changed by Alisdair McDiarmid <alisdair@randomoracle.org>

  • attachment assert-redirected-to-only-path-test.diff added.

Test case for assert_redirect_to with :only_path => false

04/27/05 02:32:28 changed by Alisdair McDiarmid <alisdair@randomoracle.org>

  • attachment assert-redirected-to-only-path-fix.diff added.

Fix for assert_redirect_to with :only_path => false

04/27/05 02:32:50 changed by Alisdair McDiarmid <alisdair@randomoracle.org>

  • summary changed from assert_redirected_to fails with :only_path => false to [PATCH] assert_redirected_to fails with :only_path => false.

04/30/05 08:34:06 changed by anonymous

  • status changed from new to closed.
  • resolution set to fixed.