Sha256: ea219b9a3007fc0948832c1a0f180da5e63ed6281bfffabaa320b9890f6625b7

Contents?: true

Size: 954 Bytes

Versions: 2

Compression:

Stored size: 954 Bytes

Contents

require 'kookaburra/exceptions'

class Kookaburra
  # Include this module wherever you need to be able to make a quick,
  # low-ceremony assertion.
  module Assertion
    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.
    #
    # @param [boolean expression] test an expression that will be evaluated in a boolean context
    # @param [String] message the exception message that will be used if
    #   test is false
    #
    # @raise [Kookaburra::AssertionFailed] raised if test evaluates to false
    def assert(test, message = "You might want to provide a better message, eh?")
      (!!test == true) or raise AssertionFailed, message
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kookaburra-3.0.1 lib/kookaburra/assertion.rb
kookaburra-3.0.0 lib/kookaburra/assertion.rb