<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/webrat/merb/merb_session_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,6 @@
 require &quot;webrat&quot;
+
+require &quot;action_controller&quot;
 require &quot;action_controller/integration&quot;
 
 module Webrat</diff>
      <filename>lib/webrat/rails.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,15 +7,24 @@ begin require &quot;redgreen&quot; unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
 webrat_path = File.expand_path(File.dirname(__FILE__) + &quot;/../lib/&quot;)
 $LOAD_PATH.unshift(webrat_path) unless $LOAD_PATH.include?(webrat_path)
 
-require &quot;merb-core&quot;
-require &quot;webrat/merb&quot;
-
 require &quot;webrat&quot;
 require File.expand_path(File.dirname(__FILE__) + &quot;/fakes/test_session&quot;)
 
+module Webrat
+  @@previous_config = nil
+
+  def self.cache_config_for_test
+    @@previous_config = Webrat.configuration.clone
+  end
+
+  def self.reset_for_test
+    @@configuration = @@previous_config if @@previous_config
+  end
+end
+
 Spec::Runner.configure do |config|
   include Webrat::Methods
-
+  
   def with_html(html)
     raise &quot;This doesn't look like HTML. Wrap it in a &lt;html&gt; tag&quot; unless html =~ /^\s*&lt;[^Hh&gt;]*html/i
     webrat_session.response_body = html
@@ -26,22 +35,15 @@ Spec::Runner.configure do |config|
     webrat_session.response_body = xml
   end
   
-end
-
-module Webrat
-  @@previous_config = nil
-
-  def self.cache_config_for_test
-    @@previous_config = Webrat.configuration.clone
-  end
-
-  def self.reset_for_test
-    @@configuration = @@previous_config if @@previous_config
+  config.before :each do
+    Webrat.cache_config_for_test
   end
   
-  class Configuration
-    def mode_for_test= (mode)
-      @mode = mode
-    end
+  config.after :each do
+    Webrat.reset_for_test
   end
-end
\ No newline at end of file
+end
+
+Webrat.configure do |config|
+  config.mode = :merb
+end</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,14 +4,6 @@ describe Webrat::Configuration do
   predicate_matchers[:parse_with_nokogiri]  = :parse_with_nokogiri?
   predicate_matchers[:open_error_files]     = :open_error_files?
 
-  before do
-    Webrat.cache_config_for_test
-  end
-  
-  after do
-    Webrat.reset_for_test
-  end
-
   it &quot;should have a mode&quot; do
     Webrat.configuration.should respond_to(:mode)
   end</diff>
      <filename>spec/webrat/core/configuration_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -87,12 +87,8 @@ describe Webrat::Session do
 
   describe &quot;#request_page&quot; do
     before(:each) do
-      Webrat.cache_config_for_test
       webrat_session = Webrat::Session.new
     end
-    after(:each) do
-      Webrat.reset_for_test
-    end
   
     it &quot;should raise an error if the request is not a success&quot; do
       webrat_session.stub!(:get)</diff>
      <filename>spec/webrat/core/session_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,14 +1,11 @@
 require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
 
-describe &quot;Webrat::MechanizeSession&quot; do
-  before :all do
-    Webrat.cache_config_for_test
+require &quot;webrat/mechanize&quot;
+
+describe Webrat::MechanizeSession do
+  before :each do
     Webrat.configuration.mode = :mechanize
   end
-  
-  after :all do
-    Webrat.reset_for_test
-  end
 
   before(:each) do
     @mech = Webrat::MechanizeSession.new</diff>
      <filename>spec/webrat/mechanize/mechanize_session_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,4 @@
 require File.expand_path(File.dirname(__FILE__) + &quot;/../../spec_helper&quot;)
-require File.expand_path(File.dirname(__FILE__) + &quot;/helper&quot;)
 
 describe HashWithIndifferentAccess do
   it &quot;should not update constructor when not a hash&quot; do</diff>
      <filename>spec/webrat/merb/indifferent_access_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,8 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
 
 describe &quot;attach_file&quot; do
   before do
+    Webrat.configuration.mode = :rails
     @filename = __FILE__
     @uploaded_file = mock(&quot;uploaded file&quot;)
     ActionController::TestUploadedFile.stub!(:new =&gt; @uploaded_file)</diff>
      <filename>spec/webrat/rails/attaches_file_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,12 @@
-require File.expand_path(File.dirname(__FILE__) + '/helper')
+require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+
+require &quot;webrat/rails&quot;
 
 describe Webrat::RailsSession do
+  before do
+    Webrat.configuration.mode = :rails
+  end
+  
   it &quot;should delegate response_body to the session response body&quot; do
     response = mock(&quot;response&quot;, :body =&gt; &quot;&lt;html&gt;&quot;)
     integration_session = mock(&quot;integration session&quot;, :response =&gt; response)</diff>
      <filename>spec/webrat/rails/rails_session_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>spec/webrat/merb/helper.rb</filename>
    </removed>
    <removed>
      <filename>spec/webrat/merb/session_spec.rb</filename>
    </removed>
    <removed>
      <filename>spec/webrat/rails/helper.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>22c7834512190c5991cd0ff9e27c750037be0405</id>
    </parent>
  </parents>
  <author>
    <name>Bryan Helmkamp</name>
    <email>bryan@brynary.com</email>
  </author>
  <url>http://github.com/brynary/webrat/commit/0eaad5276871b4f98da56ae560fa11f4dc8ee6b1</url>
  <id>0eaad5276871b4f98da56ae560fa11f4dc8ee6b1</id>
  <committed-date>2008-12-25T20:28:29-08:00</committed-date>
  <authored-date>2008-12-25T20:25:27-08:00</authored-date>
  <message>Cleanup the way the tests switch Webrat modes</message>
  <tree>0f4a90e5dd6d0e080fb17ef5c3cef8243f55eebf</tree>
  <committer>
    <name>Bryan Helmkamp</name>
    <email>bryan@brynary.com</email>
  </committer>
</commit>
