Created
March 17, 2010 17:07
-
-
Save lukeredpath/335465 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ActionController::IntegrationTest.class_eval do | |
| # override webrat's visit method to handle rack redirects | |
| # see http://is.gd/aM89F for more information about this | |
| def visit(*args) | |
| super(*args) | |
| if rack_middleware_has_redirected? | |
| visit @integration_session.headers["Location"] | |
| end | |
| end | |
| private | |
| def rack_middleware_has_redirected? | |
| [301, 302].include?(@integration_session.status) && @response.status == 200 | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment