Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Created March 17, 2010 17:07
Show Gist options
  • Select an option

  • Save lukeredpath/335465 to your computer and use it in GitHub Desktop.

Select an option

Save lukeredpath/335465 to your computer and use it in GitHub Desktop.
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