Webrat 0.7.2 problem with Rails 3.0.3

Problem
You are trying to use Webrat with a new Rails 3.0.3 application but the redirection doesn’t work, and you get an error like:
You are being redirected. (RSpec::Expectations::ExpectationNotMetError)

Solution
According to a post here, there is a way to patch the webrat code so it follows the redirection.
After adding what is suggested above into your webrat/lib/core/session.rb, ie:

#starting at line 288
def current_host
- URI.parse(current_url).host || @custom_headers["Host"] ||
"www.example.com"
+ 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

and running your tests again, they should work.

Thanks yannnimac 🙂