<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/other/should_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -8,13 +8,13 @@ module Thoughtbot
 
     VERSION = '1.1.1'
 
-    # = Should statements
+    # == Should statements
     #
     # Should statements are just syntactic sugar over normal Test::Unit test methods.  A should block 
     # contains all the normal code and assertions you're used to seeing, with the added benefit that 
     # they can be wrapped inside context blocks (see below).
     #
-    # == Example:
+    # === Example:
     #
     #  class UserTest &lt;&lt; Test::Unit::TestCase
     #    
@@ -32,21 +32,35 @@ module Thoughtbot
     # * &lt;tt&gt;&quot;test: User should return its full name. &quot;&lt;/tt&gt;
     #
     # Note: The part before &lt;tt&gt;should&lt;/tt&gt; in the test name is gleamed from the name of the Test::Unit class.
+    #
+    # Should statements can also take a Proc as a &lt;tt&gt;:before &lt;/tt&gt;option.  This proc runs after any
+    # parent context's setups but before the current context's setup.
+    #
+    # === Example:
+    #
+    #  context &quot;Some context&quot; do
+    #    setup { puts(&quot;I run after the :before proc&quot;) }
+    #
+    #    should &quot;run a :before proc&quot;, :before =&gt; lambda { puts(&quot;I run before the setup&quot;) }  do
+    #      assert true
+    #    end
+    #  end
 
-    def should(name, &amp;blk)
+    def should(name, options = {}, &amp;blk)
       if Shoulda.current_context
-        block_given? ? Shoulda.current_context.should(name, &amp;blk) : Should.current_context.should_eventually(name)
+        block_given? ? Shoulda.current_context.should(name, options, &amp;blk) : Should.current_context.should_eventually(name)
       else
         context_name = self.name.gsub(/Test/, &quot;&quot;)
         context = Thoughtbot::Shoulda::Context.new(context_name, self) do
-          block_given? ? should(name, &amp;blk) : should_eventually(name)
+          block_given? ? should(name, options, &amp;blk) : should_eventually(name)
         end
         context.build
       end
     end
 
+
     # Just like should, but never runs, and instead prints an 'X' in the Test::Unit output.
-    def should_eventually(name, &amp;blk)
+    def should_eventually(name, options = {}, &amp;blk)
       context_name = self.name.gsub(/Test/, &quot;&quot;)
       context = Thoughtbot::Shoulda::Context.new(context_name, self) do
         should_eventually(name, &amp;blk)
@@ -54,7 +68,7 @@ module Thoughtbot
       context.build
     end
 
-    # = Contexts
+    # == Contexts
     # 
     # A context block groups should statements under a common set of setup/teardown methods.  
     # Context blocks can be arbitrarily nested, and can do wonders for improving the maintainability
@@ -154,9 +168,9 @@ module Thoughtbot
         self.teardown_blocks &lt;&lt; blk
       end
 
-      def should(name, &amp;blk)
+      def should(name, options = {}, &amp;blk)
         if block_given?
-          self.shoulds &lt;&lt; { :name =&gt; name, :block =&gt; blk }
+          self.shoulds &lt;&lt; { :name =&gt; name, :before =&gt; options[:before], :block =&gt; blk }
         else
          self.should_eventuallys &lt;&lt; { :name =&gt; name }
        end
@@ -189,7 +203,9 @@ module Thoughtbot
         context = self
         test_unit_class.send(:define_method, test_name) do
           begin
-            context.run_all_setup_blocks(self)
+            context.run_parent_setup_blocks(self)
+            should[:before].bind(self).call if should[:before]
+            context.run_current_setup_blocks(self)
             should[:block].bind(self).call
           ensure
             context.run_all_teardown_blocks(self)
@@ -198,7 +214,15 @@ module Thoughtbot
       end
 
       def run_all_setup_blocks(binding)
+        run_parent_setup_blocks(binding)
+        run_current_setup_blocks(binding)
+      end
+
+      def run_parent_setup_blocks(binding)
         self.parent.run_all_setup_blocks(binding) if am_subcontext?
+      end
+
+      def run_current_setup_blocks(binding)
         setup_blocks.each do |setup_block|
           setup_block.bind(binding).call
         end</diff>
      <filename>lib/shoulda/gem/shoulda.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9f8c29edf3e632cdbc9756f6c5792bdc8cc9494c</id>
    </parent>
  </parents>
  <author>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </author>
  <url>http://github.com/rmm5t/shoulda/commit/e6e2f6b906edc4ecd6d7f8a77046216e308d1cf0</url>
  <id>e6e2f6b906edc4ecd6d7f8a77046216e308d1cf0</id>
  <committed-date>2008-07-08T17:58:20-07:00</committed-date>
  <authored-date>2008-07-08T17:58:05-07:00</authored-date>
  <message>Added support for passing a :before Proc option to a should statement</message>
  <tree>d920d6adc4224db5e95d97cfaadf1bb720e015b7</tree>
  <committer>
    <name>Ryan McGeary</name>
    <email>ryanongit@mcgeary.org</email>
  </committer>
</commit>
