<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -15,6 +15,33 @@ module ThoughtBot # :nodoc:
           end
           fixtures *all_fixtures
         end
+
+        # Macro that creates a test asserting the numeric difference between the
+        # return value of an expression that is run before and after the current
+        # setup block is run.  This is similar to Active Support's
+        # &lt;tt&gt;assert_difference&lt;/tt&gt; assertion.
+        #
+        # Example:
+        #
+        #   context &quot;Creating a post&quot;
+        #     setup do 
+        #       Post.create
+        #     end
+        #
+        #     should_differ &quot;Post.count&quot;, :by =&gt; 1
+        #   end
+        #
+        # While not shown in this example, the &lt;tt&gt;:by&lt;/tt&gt; option is optional
+        # and defaults to &lt;tt&gt;1&lt;/tt&gt;.
+        def should_differ(expression, options = {})
+          difference = options[:by] || 1
+          expression_evaluation = lambda { eval(expression) }
+          before = lambda { @_should_differ_value = expression_evaluation.bind(self).call }
+          should &quot;differ '#{expression}' by #{difference}&quot;, :before =&gt; before do
+            assert_equal @_should_differ_value + difference, expression_evaluation.bind(self).call
+          end
+        end
+        
       end
       
       # Prints a message to stdout, tagged with the name of the calling method.</diff>
      <filename>lib/shoulda/general.rb</filename>
    </modified>
    <modified>
      <diff>@@ -76,5 +76,22 @@ class HelpersTest &lt; Test::Unit::TestCase # :nodoc:
         assert_same_elements([@a, &quot;abc&quot;].flatten, [3, 3, &quot;def&quot;, &quot;abc&quot;])
       end
     end
+    
+    context &quot;after adding another value&quot; do
+      setup do
+        @a.push(&quot;another&quot;)
+      end
+      
+      # testing the default :by option of 1
+      should_differ &quot;@a.length&quot; 
+    end
+    
+    context &quot;after adding 3 more values&quot; do
+      setup do
+        @a.push(1, 2, 3)
+      end
+      
+      should_differ &quot;@a.length&quot;, :by =&gt; 3
+    end
   end
 end</diff>
      <filename>test/other/helpers_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e6e2f6b906edc4ecd6d7f8a77046216e308d1cf0</id>
    </parent>
  </parents>
  <author>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </author>
  <url>http://github.com/rmm5t/shoulda/commit/9294040046ea64d6c93a92fe3c01f453f3d8450a</url>
  <id>9294040046ea64d6c93a92fe3c01f453f3d8450a</id>
  <committed-date>2008-07-08T19:05:46-07:00</committed-date>
  <authored-date>2008-07-08T19:05:46-07:00</authored-date>
  <message>Added new should_differ macro; akin to Active Support's assert_difference.</message>
  <tree>36e8211eb8ae7ee1ef0b7e0bc8cffeb519779257</tree>
  <committer>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </committer>
</commit>
