Created
December 23, 2010 09:22
-
-
Save bru/752766 to your computer and use it in GitHub Desktop.
monkey patch to fix webrat follow redirect behaviour with rails 3
This file contains 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
# features/support/env.rb | |
require 'webrat' | |
require 'webrat/core/matchers' | |
Webrat.configure do |config| | |
config.mode = :rack | |
config.open_error_files = false # Set to true if you want error pages to pop up in the browser | |
end | |
World(Webrat::Methods) | |
World(Webrat::Matchers) |
This file contains 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
# features/support/webrat.rb | |
module Webrat | |
class Session | |
def current_host | |
URI.parse(current_url).host || @custom_headers["Host"] || default_current_host | |
end | |
def default_current_host | |
adapter.class==Webrat::RackAdapter ? "example.org" : "www.example.com" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, this just solved my problem