Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows assert_redirected_to to accept a regular expression #6135

Merged
merged 1 commit into from May 3, 2012

Conversation

alindeman
Copy link
Contributor

I have a few places where I really only care to assert that the URL matches a regular expression.

This patch allows it while keeping the semantics the same when a String or Hash is passed to assert_redirected_to

@alindeman
Copy link
Contributor Author

Previous discussion at #3792. I had deleted my fork since then, so couldn't force push it.

@controller.url_for(fragment)
end.delete("\0\r\n")
normalized = case fragment
when Regexp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in Rails we don't indent the case like this, but instead we simply do:

normalize = case fragment
  when Regexp
    ...
end

Could you please adjust?

@josevalim
Copy link
Contributor

@alindeman I like this! Could you please fix the issues commented above and ping me when you are done? Thanks!

@alindeman
Copy link
Contributor Author

Thanks @josevalim. I think I've addressed all the comments.

josevalim added a commit that referenced this pull request May 3, 2012
Allows assert_redirected_to to accept a regular expression
@josevalim josevalim merged commit 9de9e6a into rails:master May 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants