Class: RSpecial::Expect
- Inherits:
-
Object
- Object
- RSpecial::Expect
- Defined in:
- lib/rspecial/expect.rb
Overview
Wraps the target of an expectation.
Instance Method Summary collapse
-
#initialize(target) ⇒ Expect
constructor
private
A new instance of Expect.
-
#to(matcher = nil, message = nil, &block) ⇒ Boolean
Runs the given expectation, passing if ‘matcher` returns true.
-
#to_not(matcher = nil, message = nil, &block) ⇒ Boolean
(also: #not_to)
Runs the given expectation, passing if ‘matcher` returns false.
Constructor Details
#initialize(target) ⇒ Expect
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 Expect.
17 18 19 |
# File 'lib/rspecial/expect.rb', line 17 def initialize(target) @target = target end |
Instance Method Details
#to(matcher = nil, message = nil, &block) ⇒ Boolean
Runs the given expectation, passing if ‘matcher` returns true.
36 37 38 39 |
# File 'lib/rspecial/expect.rb', line 36 def to(matcher=nil, =nil, &block) #prevent_operator_matchers(:to, matcher) handle_positive_matcher(@target, matcher, , &block) end |
#to_not(matcher = nil, message = nil, &block) ⇒ Boolean Also known as: not_to
Runs the given expectation, passing if ‘matcher` returns false.
56 57 58 59 |
# File 'lib/rspecial/expect.rb', line 56 def to_not(matcher=nil, =nil, &block) #prevent_operator_matchers(:to_not, matcher) handle_negative_matcher(@target, matcher, , &block) end |