Module: Junkfood::Assert
- Defined in:
- lib/junkfood/assert.rb
Overview
A dumbed down implementation for Assertions based on the ‘wrong’ gem, but without any of wrong’s awesomeness. This is just for the future in case ‘wrong’ disappears from the scene.
Defined Under Namespace
Classes: AssertionFailedError
Instance Method Summary collapse
-
#assert(*args, &block) ⇒ Object
Tests an assertion claim.
Instance Method Details
#assert { ... } ⇒ Object #assert(message) { ... } ⇒ Object
Tests an assertion claim.
66 67 68 69 70 71 72 73 |
# File 'lib/junkfood/assert.rb', line 66 def assert(*args, &block) begin return super if block.nil? rescue NoMethodError raise 'You must pass a block for assertion check' end raise AssertionFailedError, args.first unless yield end |