require_relative 'matcher' module Expect # Wraps the target of an expectation. # # @example # this { stuff } # => ExpectationTarget wrapping the block class ExpectationTarget < BasicObject def initialize(&actual) @actual = actual end # Evaluate to a positive assertion. # # @api public # # @param [Hash, Symbol] definition # # @return [Boolean] report if the expectation is true or false def to(definition) Matcher.pass?(definition, &@actual) end # Evaluate to a negative assertion. # # @api public # # @param [Hash, Symbol] definition # # @return [Boolean] report if the expectation is true or false def not_to(definition) to(definition).equal?(false) end end end