Sha256: 88957504845569f5d2adbe70c5ec58e42440fca3a1a5e489e2db81e1ce72d088

Contents?: true

Size: 633 Bytes

Versions: 2

Compression:

Stored size: 633 Bytes

Contents

require_relative 'matcher'

module Expect
  # Wraps the target of an expectation.
  #
  # @example
  #   expect { do_something } # => 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

2 entries across 2 versions & 1 rubygems

Version Path
expect-0.0.2 lib/expect/expectation_target.rb
expect-0.0.1 lib/expect/expectation_target.rb