Class: Spectus::ExpectationTarget Private

Inherits:
Object
  • Object
show all
Defined in:
lib/spectus/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:

expect { do_something } # => ExpectationTarget wrapping the block

API:

  • private

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.

API:

  • private



10
11
12
13
14
# File 'lib/spectus/expectation_target.rb', line 10

def initialize &actual
  @actual = actual

  freeze
end

Instance Method Details

#not_to(definition) ⇒ Object

Evaluate to a negative assertion.

See Also:

API:

  • public



30
31
32
# File 'lib/spectus/expectation_target.rb', line 30

def not_to definition
  Matcher.eval true, definition, &@actual
end

#to(definition) ⇒ Object

Evaluate to a positive assertion.

See Also:

API:

  • public



21
22
23
# File 'lib/spectus/expectation_target.rb', line 21

def to definition
  Matcher.eval false, definition, &@actual
end