Class: RSpec::ExpectationTarget::Base Private
- Inherits:
-
Object
- Object
- RSpec::ExpectationTarget::Base
- Defined in:
- lib/r_spec/expectation_target/base.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.
Note:
‘RSpec::ExpectationTarget::Base` is not intended to be instantiated directly by users. Use `expect` instead.
Abstract expectation target base class.
Instance Method Summary collapse
-
#initialize(actual) ⇒ Base
constructor
private
Instantiate a new expectation target.
-
#not_to(matcher) ⇒ nil
Runs the given expectation, passing if ‘matcher` returns false.
-
#to(matcher) ⇒ nil
Runs the given expectation, passing if ‘matcher` returns true.
Constructor Details
#initialize(actual) ⇒ Base
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.
Instantiate a new expectation target.
18 19 20 |
# File 'lib/r_spec/expectation_target/base.rb', line 18 def initialize(actual) @actual = actual end |
Instance Method Details
#not_to(matcher) ⇒ nil
Runs the given expectation, passing if ‘matcher` returns false.
48 49 50 |
# File 'lib/r_spec/expectation_target/base.rb', line 48 def not_to(matcher) absolute_requirement(matcher: matcher, negate: true) end |
#to(matcher) ⇒ nil
Runs the given expectation, passing if ‘matcher` returns true.
33 34 35 |
# File 'lib/r_spec/expectation_target/base.rb', line 33 def to(matcher) absolute_requirement(matcher: matcher, negate: false) end |