Skip to content

Fix #10842. `assert_redirected_to` does not show user-supplied message. #10800

Merged
merged 1 commit into from Jul 18, 2013

2 participants

@907th
907th commented May 30, 2013

Fix #10842

Issue: when assert_redirected_to fails due to the response redirect not
matching the expected redirect the user-supplied message (second parameter)
is not shown. This message is only shown if the response is not a redirect.

If ...

assert_redirected_to login_path, "Expected redirect to login page"

... there is redirection not to login_path then we don't see "Expected redirect to login page." but only default "Expected response to be a redirect to /login but was a redirect to /other." message.

The issue was first mentioned in 2011 but was not fixed in 3.* branch. I faced with it several days ago.

In 4.* action_dispatch tests helpers were refactored so 4.* has no such bug.

@907th
907th commented Jul 18, 2013

@rafaelfranca Cant you take a look at it? It fixes assert_redirected_to in 3.2 branch

@rafaelfranca
Ruby on Rails member

Seems good. Could you add a test case?

@rafaelfranca
Ruby on Rails member

Also it needs a rebase

@907th
907th commented Jul 18, 2013

I'm not sure how to test assert message.

@rafaelfranca
Ruby on Rails member

Well, would be hard to write tests to assert_redirect_to so you don't need to add a test case. But this PR needs a rebase.

@907th
907th commented Jul 18, 2013

ok

@907th 907th Fix `assert_redirected_to` does not show user-supplied message.
Issue: when `assert_redirected_to` fails due to the response redirect not
matching the expected redirect the user-supplied message (second parameter)
is not shown. This message is only shown if the response is not a redirect.
0f5ba6e
@907th
907th commented Jul 18, 2013

rebased onto 3-2-stable

@rafaelfranca rafaelfranca merged commit 39441f7 into rails:3-2-stable Jul 18, 2013

1 check was pending

Details default The Travis CI build is in progress
@907th 907th deleted the unknown repository branch Jul 18, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.