summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorYossef Mendelssohn <ymendel@pobox.com>2008-10-24 17:01:51 -0500
committerYossef Mendelssohn <ymendel@pobox.com>2008-10-24 17:15:01 -0500
commita52cbeac0162b6f786f0ee9fc8b34d74cf4abc6e (patch)
tree50441067f9eb425aa790d60538be52ef284e8ed8 /test
parent3271c1d2c4fe469301274a04a7b28b372f68913c (diff)
downloadbacon-a52cbeac0162b6f786f0ee9fc8b34d74cf4abc6e.tar.gz
bacon-a52cbeac0162b6f786f0ee9fc8b34d74cf4abc6e.tar.xz
bacon-a52cbeac0162b6f786f0ee9fc8b34d74cf4abc6e.zip
Letting before blocks be run from higher levels in nested context
Split up Context#initialize to let running be a separate step.
Added attr_reader for Context name and block to let the running step have access
to them without resorting to instance variables.
Diffstat (limited to 'test')
-rw-r--r--test/spec_bacon.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/spec_bacon.rb b/test/spec_bacon.rb
index 1779704..fd3e09b 100644
--- a/test/spec_bacon.rb
+++ b/test/spec_bacon.rb
@@ -278,6 +278,25 @@ describe "before/after" do
     @a.should.equal 2
     @b.should.equal 2
   end
+  
+  describe "when nested" do
+    before do
+      @c = 5
+    end
+    
+    it "should run from higher level" do
+      @a.should.equal 2
+      @b.should.equal 2
+    end
+    
+    it "should run at the nested level" do
+      @c.should.equal 5
+    end
+  end
+  
+  it "should not run from lower level" do
+    @c.should.be.nil
+  end
 end
 
 shared "a shared context" do