Module: RSpec::Clone::ExpectationHelper::Shared Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Abstract expectation helper base module.
This module defines a number of methods to create expectations, which are automatically included into examples.
It also includes a collection of expectation matchers.
Instance Method Summary collapse
-
#be(expected) ⇒ #matches?
(also: #equal)
Identity matcher.
-
#be_an_instance_of(expected) ⇒ #matches?
Type/class matcher.
-
#be_false ⇒ #matches?
False matcher.
-
#be_nil ⇒ #matches?
Nil matcher.
-
#be_true ⇒ #matches?
True matcher.
-
#be_within(delta) ⇒ #matches?
Comparisons matcher.
-
#change(object, method) ⇒ #matches?
Change matcher.
-
#eq(expected) ⇒ #matches?
(also: #eql)
Equivalence matcher.
-
#match(expected) ⇒ #matches?
Regular expressions matcher.
-
#raise_exception(expected) ⇒ #matches?
Expecting errors matcher.
-
#satisfy ⇒ #matches?
Satisfy matcher.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object (private)
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.
Predicate matcher, or default method missing behavior.
224 225 226 227 228 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 224 def method_missing(name, ...) return super unless predicate_matcher_name?(name) ::Matchi::Predicate.new(name, ...) end |
Instance Method Details
#be(expected) ⇒ #matches? Also known as: equal
Identity matcher
48 49 50 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 48 def be(expected) ::Matchi::Be.new(expected) end |
#be_an_instance_of(expected) ⇒ #matches?
Type/class matcher
162 163 164 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 162 def be_an_instance_of(expected) ::Matchi::BeAnInstanceOf.new(expected) end |
#be_false ⇒ #matches?
False matcher
130 131 132 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 130 def be_false be(false) end |
#be_nil ⇒ #matches?
Nil matcher
146 147 148 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 146 def be_nil be(nil) end |
#be_true ⇒ #matches?
True matcher
114 115 116 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 114 def be_true be(true) end |
#be_within(delta) ⇒ #matches?
Comparisons matcher
66 67 68 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 66 def be_within(delta) ::Matchi::BeWithin.new(delta) end |
#change(object, method) ⇒ #matches?
Change matcher
197 198 199 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 197 def change(object, method, ...) ::Matchi::Change.new(object, method, ...) end |
#eq(expected) ⇒ #matches? Also known as: eql
Equivalence matcher
29 30 31 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 29 def eq(expected) ::Matchi::Eq.new(expected) end |
#match(expected) ⇒ #matches?
Regular expressions matcher
82 83 84 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 82 def match(expected) ::Matchi::Match.new(expected) end |
#raise_exception(expected) ⇒ #matches?
Expecting errors matcher
98 99 100 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 98 def raise_exception(expected) ::Matchi::RaiseException.new(expected) end |
#satisfy ⇒ #matches?
Satisfy matcher
212 213 214 |
# File 'lib/r_spec/clone/expectation_helper/shared.rb', line 212 def satisfy(&) ::Matchi::Satisfy.new(&) end |