<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,55 +5,63 @@ require File.dirname(__FILE__) + '/../init'
 describe 'auto focusable form' do
   include ViewTestHelper
 
-  setup do
+  before do
     create_active_record_instance_variable 'post', :title =&gt; '', :content =&gt; ''
     create_active_record_instance_variable 'author', :name =&gt; '', :surname =&gt; ''
   end
 
   it 'should give focus only to the first element of the form' do
-    _erbout = first = second = ''
+    first_input = second_input = ''
 
-    form_for @post do |f|
-      first = f.text_field :title
-      second = f.text_field :content
+    capture do
+      form_for @post do |f|
+        first_input = f.text_field :title
+        second_input = f.text_field :content
+      end
     end
 
-    assert_field_has_focus first
-    assert_field_has_no_focus second
+    assert_field_has_focus first_input
+    assert_field_has_no_focus second_input
   end
 
   it 'should allow disabling autofocus' do
-    _erbout = first = second = ''
+    first_input = second_input = ''
 
-    form_for @post, :autofocus =&gt; false do |f|
-      first = f.text_field :title
-      second = f.text_field :content
+    capture do
+      form_for @post, :autofocus =&gt; false do |f|
+        first_input = f.text_field :title
+        second_input = f.text_field :content
+      end
     end
 
-    assert_field_has_no_focus first
-    assert_field_has_no_focus second
+    assert_field_has_no_focus first_input
+    assert_field_has_no_focus second_input
   end
 
   it 'should use the correct input field name' do
-    _erbout = title_input = ''
+    title_input = ''
 
-    form_for @post do |f|
-      title_input = f.text_field :title
+    capture do
+      form_for @post do |f|
+        title_input = f.text_field :title
+      end
     end
 
     assert_field_has_focus title_input, 'post_title'
   end
 
   it 'should give focus only to the first field even if fields_for exists' do
-    _erbout = first = second = inner_first = inner_second = ''
-
-    form_for @post do |f|
-      first = f.text_field :title
-      fields_for @author do |g|
-        inner_first = g.text_field :name
-        inner_second = g.text_field :surname
+    first = second = inner_first = inner_second = ''
+
+    capture do
+      form_for @post do |f|
+        first = f.text_field :title
+        fields_for @author do |g|
+          inner_first = g.text_field :name
+          inner_second = g.text_field :surname
+        end
+        second = f.text_field :content
       end
-      second = f.text_field :content
     end
 
     assert_field_has_focus first
@@ -63,15 +71,17 @@ describe 'auto focusable form' do
   end
 
   it 'should give focus to the first element of an inner fields_for if it is the first element in the forms_form' do
-    _erbout = first = second = inner_first = inner_second = ''
-
-    form_for @post do |f|
-      fields_for @author do |g|
-        inner_first = g.text_field :name
-        inner_second = g.text_field :surname
+    first = second = inner_first = inner_second = ''
+
+    capture do
+      form_for @post do |f|
+        fields_for @author do |g|
+          inner_first = g.text_field :name
+          inner_second = g.text_field :surname
+        end
+        first = f.text_field :title
+        second = f.text_field :content
       end
-      first = f.text_field :title
-      second = f.text_field :content
     end
 
     assert_field_has_focus inner_first
@@ -81,41 +91,47 @@ describe 'auto focusable form' do
   end
 
   it 'should give focus to the first form when two forms exist' do
-    _erbout = first_form_input = second_form_input = ''
+    first_input = second_input = ''
 
-    form_for @post do |f|
-      first_form_input = f.text_field :title
-    end
+    capture do
+      form_for @post do |f|
+        first_input = f.text_field :title
+      end
 
-    form_for @post do |f|
-      second_form_input = f.text_field :title
+      form_for @post do |f|
+        second_input = f.text_field :title
+      end
     end
 
-    assert_field_has_focus first_form_input
-    assert_field_has_no_focus second_form_input
+    assert_field_has_focus first_input
+    assert_field_has_no_focus second_input
   end
 
   it 'should give focus to the second form when the first has :autofocus =&gt; false' do
-    _erbout = first_form_input = second_form_input = ''
+    first_input = second_input = ''
 
-    form_for @post, :autofocus =&gt; false do |f|
-      first_form_input = f.text_field :title
-    end
+    capture do
+      form_for @post, :autofocus =&gt; false do |f|
+        first_input = f.text_field :title
+      end
 
-    form_for @author do |f|
-      second_form_input = f.text_field :name
+      form_for @author do |f|
+        second_input = f.text_field :name
+      end
     end
 
-    assert_field_has_no_focus first_form_input
-    assert_field_has_focus second_form_input
+    assert_field_has_no_focus first_input
+    assert_field_has_focus second_input
   end
 
   it 'should give focus to the second input when the first has :disabled =&gt; &quot;something&quot;' do
-    _erbout = first_input = second_input = ''
+    first_input = second_input = ''
 
-    form_for @post do |f|
-      first_input = f.text_field :title, :disabled =&gt; 'something'
-      second_input = f.text_field :content
+    capture do
+      form_for @post do |f|
+        first_input = f.text_field :title, :disabled =&gt; 'something'
+        second_input = f.text_field :content
+      end
     end
 
     assert_field_has_no_focus first_input
@@ -123,11 +139,13 @@ describe 'auto focusable form' do
   end
 
   it 'should give focus to the second input when the first has :disabled =&gt; true' do
-    _erbout = first_input = second_input = ''
+    first_input = second_input = ''
 
-    form_for @post do |f|
-      first_input = f.text_field :title, :disabled =&gt; true
-      second_input = f.text_field :content
+    capture do
+      form_for @post do |f|
+        first_input = f.text_field :title, :disabled =&gt; true
+        second_input = f.text_field :content
+      end
     end
 
     assert_field_has_no_focus first_input
@@ -135,11 +153,13 @@ describe 'auto focusable form' do
   end
 
   it 'should still give focus to the first input when is :disabled =&gt; false' do
-    _erbout = first_input = second_input = ''
+    first_input = second_input = ''
 
-    form_for @post do |f|
-      first_input = f.text_field :title, :disabled =&gt; false
-      second_input = f.text_field :content
+    capture do
+      form_for @post do |f|
+        first_input = f.text_field :title, :disabled =&gt; false
+        second_input = f.text_field :content
+      end
     end
 
     assert_field_has_focus first_input
@@ -147,11 +167,13 @@ describe 'auto focusable form' do
   end
 
   it 'should give focus to the second input when the first has :readonly =&gt; &quot;something&quot;' do
-    _erbout = first_input = second_input = ''
+    first_input = second_input = ''
 
-    form_for @post do |f|
-      first_input = f.text_field :title, :readonly =&gt; 'something'
-      second_input = f.text_field :content
+    capture do
+      form_for @post do |f|
+        first_input = f.text_field :title, :readonly =&gt; 'something'
+        second_input = f.text_field :content
+      end
     end
 
     assert_field_has_no_focus first_input
@@ -159,11 +181,13 @@ describe 'auto focusable form' do
   end
 
   it 'should give focus to the second input when the first has :readonly =&gt; true' do
-    _erbout = first_input = second_input = ''
+    first_input = second_input = ''
 
-    form_for @post do |f|
-      first_input = f.text_field :title, :readonly =&gt; true
-      second_input = f.text_field :content
+    capture do
+      form_for @post do |f|
+        first_input = f.text_field :title, :readonly =&gt; true
+        second_input = f.text_field :content
+      end
     end
 
     assert_field_has_no_focus first_input
@@ -171,11 +195,13 @@ describe 'auto focusable form' do
   end
 
   it 'should still give focus to the first input when is :readonly =&gt; false' do
-    _erbout = first_input = second_input = ''
+    first_input = second_input = ''
 
-    form_for @post do |f|
-      first_input = f.text_field :title, :readonly =&gt; false
-      second_input = f.text_field :content
+    capture do
+      form_for @post do |f|
+        first_input = f.text_field :title, :readonly =&gt; false
+        second_input = f.text_field :content
+      end
     end
 
     assert_field_has_focus first_input</diff>
      <filename>spec/auto_focusable_forms_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,8 @@ require 'rexml/document'
 require 'rspec_hpricot_matchers'
 
 module ViewTestHelper
+  attr_accessor :output_buffer
+
   include ActionView::Helpers::FormHelper
   include ActionView::Helpers::FormTagHelper
   include ActionView::Helpers::UrlHelper
@@ -14,6 +16,7 @@ module ViewTestHelper
   include ActionView::Helpers::TextHelper
   include ActionView::Helpers::ActiveRecordHelper
   include ActionView::Helpers::RecordIdentificationHelper
+  include ActionView::Helpers::CaptureHelper
   include ActiveSupport
   include ActionController::PolymorphicRoutes
 </diff>
      <filename>spec/view_test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>19e2e2ed9e700301679b1cfdcc0757b9dd33cd49</id>
    </parent>
  </parents>
  <author>
    <name>Daniel Cadenas</name>
    <email>dcadenas@gmail.com</email>
  </author>
  <url>http://github.com/dcadenas/auto_focusable_forms/commit/595b5533524a92d9d4428e9076cd9c64c86e306c</url>
  <id>595b5533524a92d9d4428e9076cd9c64c86e306c</id>
  <committed-date>2009-05-30T01:56:12-07:00</committed-date>
  <authored-date>2009-05-30T01:17:27-07:00</authored-date>
  <message>Make tests pass with latest version of rails and rspec</message>
  <tree>a95c507453f664b64daff9e2f19b3c86c6266a60</tree>
  <committer>
    <name>Daniel Cadenas</name>
    <email>dcadenas@gmail.com</email>
  </committer>
</commit>
