Patch for Rails 3 controller redirects #46

wants to merge 2 commits into


None yet
7 participants

Now that Rails 3 is an actual Rack application the testing urls are not working with controller redirects (redirect_to some_path). These return a page with only "You are being redirected." as the content currently and on webrat/master. This corrects that issue and allows for the redirects to happen as would be expected.

raid5 commented Jan 10, 2011

Can't wait for this patch to be accepted. A lot of people seem to be having issues related to this at the moment.

+1 I've been banging my head against this for the past 4 hours. Glad to see it's not just me.

jphpsf commented Feb 14, 2011


For now, I've been placing the a webrat_host_fix.rb file under features/support/ (I am using cucumber)

# Fix the issue between webrat 0.7.3 using "" and rails 3.x using ""
Webrat::Session.class_eval do
    def current_host
        URI.parse(current_url).host || @custom_headers["Host"] || default_current_host

    def default_current_host
        adapter.class == Webrat::RackAdapter ? "" : ""


Difficult to perform any valuable testing with cucumber and webrat without this fix.


Can't wait to remove the hack that override the DEFAULT_HOST constant to avoid the "already initialized constant DEFAULT_HOST" warning.


dlibanori commented Mar 3, 2011

Nice work, but I think it is tightly coupled with Rack::Test internals. I did another patch, improving Webrat specs and less coupled with Rack::Test.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment