Sha256: 5481c4467e087ae357b664de3b17884bec6811221f1801c4ef133fd621b491d4
Contents?: true
Size: 1.13 KB
Versions: 11
Compression:
Stored size: 1.13 KB
Contents
class Object def before(at=:each, &block) MSpec.current.before at, &block end def after(at=:each, &block) MSpec.current.after at, &block end def describe(mod, msg=nil, options=nil, &block) MSpec.describe mod, msg, &block end def it(msg, &block) MSpec.current.it msg, &block end def it_should_behave_like(desc) MSpec.current.it_should_behave_like desc end # For ReadRuby compatiability def doc(*a) end def call_block(&block) block.call return nil rescue Exception => e return e end NO_BLOCK_PASSED = "you must pass a block to the eventually method" def eventually options = {}, &block raise NO_BLOCK_PASSED if block.nil? timeout = options[:timeout] || 5 delay = options[:delay] || 0.25 last_error = nil begin_time = Time.now while (Time.now - begin_time) < timeout e = call_block(&block) if e then last_error = e sleep delay else return end end raise last_error end alias_method :context, :describe alias_method :specify, :it end
Version data entries
11 entries across 11 versions & 2 rubygems