spec/spec.grammar.js in visionmedia-jspec-1.1.4 vs spec/spec.grammar.js in visionmedia-jspec-1.1.5
- old
+ new
@@ -74,58 +74,88 @@
end
end
end
describe 'before / after blocks'
- var n, o
+ var n, o, hits = []
before
n = 1
+ hits.push('before')
end
after
n = 0
+ hits.push('after')
end
it 'should work'
n.should.eql 1
+ hits.should.eql ['before']
n++
end
it 'should persist'
n.should.eql 2
+ hits.should.eql ['before']
end
describe 'with nested describe'
it 'should be accessable'
- n.should.eql 0
+ n.should.eql 1
+ hits.should.eql ['before', 'before']
end
end
end
describe 'before_each / after_each blocks'
+ hits = []
+
before_each
n = 1
+ hits.push('before_each')
end
after_each
o = 2
+ hits.push('after_each')
end
it 'should work'
n.should.eql 1
+ hits.should.eql ['before_each']
n = 2
end
it 'should not persist'
n.should.eql 1
o.should.eql 2
+ hits.should.eql ['before_each', 'after_each', 'before_each']
end
describe 'with nested describe'
it 'should be accessable'
n.should.eql 1
o.should.eql 2
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each']
+ end
+
+ it 'should continue hits'
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each']
+ end
+
+ describe 'with more hooks'
+ before_each
+ hits.push('before_each')
+ end
+
+ after_each
+ hits.push('after_each')
+ end
+
+ it 'should continue hits, while cascading properly'
+ hits.should.eql ['before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'after_each', 'before_each', 'before_each']
+ end
end
end
end
end
\ No newline at end of file