Method: Wrong::Assert#assert
- Defined in:
- lib/wrong/assert.rb
#assert(*args, &block) ⇒ Object
Actual signature: assert(explanation = nil, depth = 0, &block)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/wrong/assert.rb', line 21 def assert(*args, &block) # to notice (and fail fast from) odd recursion problem raise "Reentry bug while trying to assert(#{args.join(', ')})" if (@_inside_wrong_assert ||= nil) @_inside_wrong_assert = true if block.nil? begin super(*args) # if there's a framework assert method (sans block), then call it rescue NoMethodError => e # note: we're not raising an AssertionFailedError because this is a programmer error, not a failed assertion raise "You must pass a block to Wrong's assert and deny methods" end else aver(:assert, *args, &block) end ensure @_inside_wrong_assert = false end |