test/test_from_readme.rb in muack-1.0.2 vs test/test_from_readme.rb in muack-1.0.3
- old
+ new
@@ -7,16 +7,15 @@
codes = readme.scan(/``` ruby(.+?)```/m).map(&:first)
after{ Muack.reset }
Context = Module.new{
- def p res
- (@results ||= []) << res
- end
+ def results; @results ||= []; end
+ def p res ; results << res ; end
def verify expects
- return unless @results
- @results.zip(expects).each do |(res, exp)|
+ return if results.empty?
+ results.zip(expects).each do |(res, exp)|
next if exp == 'ok'
if exp.start_with?('raise')
res.should.kind_of eval(exp.sub('raise', ''))
else
res.should.eq eval(exp)