Class: Expect::ExpectationTarget Private

Inherits:
BasicObject
Defined in:
lib/expect/expectation_target.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Wraps the target of an expectation.

Examples:

this { stuff } # => ExpectationTarget wrapping the block

Instance Method Summary collapse

Constructor Details

#initialize(&actual) ⇒ ExpectationTarget

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ExpectationTarget.



9
10
11
# File 'lib/expect/expectation_target.rb', line 9

def initialize(&actual)
  @actual = actual
end

Instance Method Details

#not_to(definition) ⇒ Object

Evaluate to a negative assertion.

See Also:



27
28
29
# File 'lib/expect/expectation_target.rb', line 27

def not_to(definition)
  to(definition).equal?(false)
end

#to(definition) ⇒ Object

Evaluate to a positive assertion.

See Also:



18
19
20
# File 'lib/expect/expectation_target.rb', line 18

def to(definition)
  Matcher.pass?(definition, &@actual)
end