Module: Covenant::DSL

Defined in:
lib/covenant.rb

Instance Method Summary collapse

Instance Method Details

#_assert(&block) ⇒ Object

Ensures that the condition on target evaluates to a true value.

Parameters:

  • target

    the target on which to test the condition

  • message (#to_s)

    the message that will be set if the test fails

Returns:

  • the wrapper object you can use to test your assertions

Raises:

  • (ArgumentError)


37
38
39
40
41
# File 'lib/covenant.rb', line 37

def _assert(&block)
  raise ArgumentError, "no block given" unless block_given?

  tap { yield self or raise AssertionFailed, ErrorMessage.new(block) }
end