Class: Expect::ExpectationTarget
- Inherits:
-
Object
- Object
- Expect::ExpectationTarget
- Defined in:
- lib/expect/expectation_target.rb
Overview
Wraps the target of an expectation. This class is responsible for reporting if the expectation is true or false.
Instance Attribute Summary collapse
-
#actual ⇒ BasicObject
readonly
The object to be compared with the expected one though the matcher.
Instance Method Summary collapse
-
#initialize(&actual) ⇒ ExpectationTarget
constructor
Create a new expection target.
-
#not_to(definition) ⇒ Boolean
Evaluate to a negative assertion.
-
#to(definition) ⇒ Boolean
Evaluate to a positive assertion.
Constructor Details
#initialize(&actual) ⇒ ExpectationTarget
Create a new expection target
16 17 18 |
# File 'lib/expect/expectation_target.rb', line 16 def initialize(&actual) @actual = actual end |
Instance Attribute Details
#actual ⇒ BasicObject (readonly)
Returns the object to be compared with the expected one though the matcher.
23 24 25 |
# File 'lib/expect/expectation_target.rb', line 23 def actual @actual end |
Instance Method Details
#not_to(definition) ⇒ Boolean
Evaluate to a negative assertion.
40 41 42 |
# File 'lib/expect/expectation_target.rb', line 40 def not_to(definition) !to(definition) end |
#to(definition) ⇒ Boolean
Evaluate to a positive assertion.
31 32 33 |
# File 'lib/expect/expectation_target.rb', line 31 def to(definition) matcher(definition).matches?(&actual) end |