Class: RSpec::Matchers::BuiltIn::Compound Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Compound
- Defined in:
- lib/rspec/matchers/built_in/compound.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.
Base class for and
and or
compound matchers.
Defined Under Namespace
Classes: And, NestedEvaluator, Or, SequentialEvaluator
Constant Summary
Constants inherited from BaseMatcher
Instance Method Summary collapse
- #description ⇒ String private
- #diffable? ⇒ Boolean private
- #expected ⇒ RSpec::Matchers::MultiMatcherDiff private
- #expects_call_stack_jump? ⇒ Boolean private
-
#initialize(matcher_1, matcher_2) ⇒ Compound
constructor
private
A new instance of Compound.
- #supports_block_expectations? ⇒ Boolean private
- #supports_value_expectations? ⇒ Boolean private
Methods inherited from BaseMatcher
#match_unless_raises, #matches?
Methods included from BaseMatcher::DefaultFailureMessages
#failure_message, #failure_message_when_negated
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
#initialize(matcher_1, matcher_2) ⇒ Compound
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 Compound.
10 11 12 13 |
# File 'lib/rspec/matchers/built_in/compound.rb', line 10 def initialize(matcher_1, matcher_2) @matcher_1 = matcher_1 @matcher_2 = matcher_2 end |
Instance Method Details
#description ⇒ String
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.
25 26 27 |
# File 'lib/rspec/matchers/built_in/compound.rb', line 25 def description "#{matcher_1.description} #{conjunction} #{matcher_2.description}" end |
#diffable? ⇒ Boolean
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.
49 50 51 |
# File 'lib/rspec/matchers/built_in/compound.rb', line 49 def diffable? matcher_is_diffable?(matcher_1) || matcher_is_diffable?(matcher_2) end |
#expected ⇒ RSpec::Matchers::MultiMatcherDiff
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.
55 56 57 58 |
# File 'lib/rspec/matchers/built_in/compound.rb', line 55 def expected return nil unless evaluator ::RSpec::Matchers::MultiMatcherDiff.for_many_matchers(diffable_matcher_list) end |
#expects_call_stack_jump? ⇒ Boolean
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.
42 43 44 45 |
# File 'lib/rspec/matchers/built_in/compound.rb', line 42 def expects_call_stack_jump? NestedEvaluator.matcher_expects_call_stack_jump?(matcher_1) || NestedEvaluator.matcher_expects_call_stack_jump?(matcher_2) end |
#supports_block_expectations? ⇒ Boolean
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.
30 31 32 33 |
# File 'lib/rspec/matchers/built_in/compound.rb', line 30 def supports_block_expectations? matcher_supports_block_expectations?(matcher_1) && matcher_supports_block_expectations?(matcher_2) end |
#supports_value_expectations? ⇒ Boolean
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.
36 37 38 39 |
# File 'lib/rspec/matchers/built_in/compound.rb', line 36 def supports_value_expectations? matcher_supports_value_expectations?(matcher_1) && matcher_supports_value_expectations?(matcher_2) end |