Class: RSpec::Matchers::BuiltIn::Compound Private

Inherits:
BaseMatcher
  • Object
show all
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.

Direct Known Subclasses

And, Or

Defined Under Namespace

Classes: And, NestedEvaluator, Or, SequentialEvaluator

Constant Summary

Constant Summary

Constants inherited from BaseMatcher

BaseMatcher::UNDEFINED

Instance Method Summary (collapse)

Methods inherited from BaseMatcher

#diffable?, #failure_message, #failure_message_when_negated, #match_unless_raises, #matches?

Methods included from Composable

#===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

Methods included from Pretty

#name, split_words, #to_sentence, #to_word

Constructor Details

- (Compound) initialize(matcher_1, matcher_2)

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

- (String) description

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:

  • (String)


23
24
25
# File 'lib/rspec/matchers/built_in/compound.rb', line 23

def description
  singleline_message(matcher_1.description, matcher_2.description)
end

- (Boolean) expects_call_stack_jump?

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:

  • (Boolean)


32
33
34
35
# File 'lib/rspec/matchers/built_in/compound.rb', line 32

def expects_call_stack_jump?
  NestedEvaluator.matcher_expects_call_stack_jump?(matcher_1) ||
  NestedEvaluator.matcher_expects_call_stack_jump?(matcher_2)
end

- (Boolean) supports_block_expectations?

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:

  • (Boolean)


27
28
29
30
# File 'lib/rspec/matchers/built_in/compound.rb', line 27

def supports_block_expectations?
  matcher_supports_block_expectations?(matcher_1) &&
  matcher_supports_block_expectations?(matcher_2)
end