Sha256: 18c4713713fc8aad389d54b344ff71857344109bda234486e876de80f47545a8

Contents?: true

Size: 626 Bytes

Versions: 1

Compression:

Stored size: 626 Bytes

Contents

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
    #
    # @see Matcher#pass?
    def to(definition)
      Matcher.pass?(false, definition, &@actual)
    end

    # Evaluate to a negative assertion.
    #
    # @api public
    #
    # @see Matcher#pass?
    def not_to(definition)
      Matcher.pass?(true, definition, &@actual)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
expect-0.0.3 lib/expect/expectation_target.rb