From b2dddf2f09f400b9e10d1e1770c63ca834639279 Mon Sep 17 00:00:00 2001 From: Emrys Ingersoll Date: Thu, 18 Feb 2010 18:33:22 -0500 Subject: [PATCH] Disable the automatic following of redirects in the Mechanize instance so they can be handled by Webrat::Session --- lib/webrat/adapters/mechanize.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/webrat/adapters/mechanize.rb b/lib/webrat/adapters/mechanize.rb index e97aeb9..bc79466 100644 --- a/lib/webrat/adapters/mechanize.rb +++ b/lib/webrat/adapters/mechanize.rb @@ -40,7 +40,11 @@ module Webrat #:nodoc: end def mechanize - @mechanize ||= WWW::Mechanize.new + unless @mechanize + @mechanize = Mechanize.new + @mechanize.redirect_ok = false + end + @mechanize end def_delegators :mechanize, :basic_auth