Module: Kookaburra::Assertion

Included in:
UIDriver, UIDriver::UIComponent
Defined in:
lib/kookaburra/assertion.rb

Overview

Include this module wherever you need to be able to make a quick, low-ceremony assertion.

Instance Method Summary collapse

Instance Method Details

#assert(test, message = "You might want to provide a better message, eh?") ⇒ Object (protected)

Provides a mechanism to make assertions about the state of your UIComponent without relying on a specific testing framework. A good reason to use this would be to provide a more informative error message when a pre-condition is not met, rather than waiting on an operation further down the line to fail.

Parameters:

  • test (boolean expression)

    an expression that will be evaluated in a boolean context

  • message (String) (defaults to: "You might want to provide a better message, eh?")

    the exception message that will be used if test is false

Raises:

  • (Kookaburra::AssertionFailed)

    raised if test evaluates to false



20
21
22
# File 'lib/kookaburra/assertion.rb', line 20

def assert(test, message = "You might want to provide a better message, eh?")
  (!!test == true) or raise AssertionFailed, message
end