class Minitest::ValueMonad
Constants
- VERSION
Public Class Methods
Public Instance Methods
Source
# File lib/minitest/bacon.rb, line 68 def assert msg = nil r = yield @val Minitest.poke msg ||= "boom" raise Minitest::Assertion, msg if @pos ^ r r end
Source
# File lib/minitest/bacon.rb, line 47 def be(*args, &block) if args.empty? self else block = args.shift unless block_given? block ||= lambda { @val.send(*args) } assert(&block) end end
Source
# File lib/minitest/bacon.rb, line 97 def change?(*args, &block); block.change?(*args); end
Source
# File lib/minitest/bacon.rb, line 99 def flunk(reason="Flunked") raise Minitest::Assertion, reason end
Source
# File lib/minitest/bacon.rb, line 92 def identical_to(value) self.equal? value end
Also aliased as: same_as
Source
# File lib/minitest/bacon.rb, line 78 def method_missing(name, *args, &block) name = name.to_s.sub(/^be_/, '') name = "#{name}?" if name =~ /\w[^?]\z/ msg = [] msg << "not" unless @pos msg << @val.inspect << ".#{name}" msg << "(#{args.map(&:inspect).join ", "}) failed" assert(msg.join) { @val.__send__(name, *args, &block) } end
Source
# File lib/minitest/bacon.rb, line 41 def not(*args, &block) @pos = !@pos be(*args, &block) end
Source
# File lib/minitest/bacon.rb, line 95 def raise?(*args, &block); block.raise?(*args); end
Source
# File lib/minitest/bacon.rb, line 96 def throw?(*args, &block); block.throw?(*args); end