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

### Home Classes Methods

### In Files

- lib/rspec/matchers/built_in/compound.rb

### Parent

RSpec::Matchers::BuiltIn::BaseMatcher

### Namespace

- CLASS RSpec::Matchers::BuiltIn::Compound::And
- CLASS RSpec::Matchers::BuiltIn::Compound::NestedEvaluator
- CLASS RSpec::Matchers::BuiltIn::Compound::Or
- CLASS RSpec::Matchers::BuiltIn::Compound::SequentialEvaluator

### Methods

- ::new
- #description
- #diffable?
- #diffable_matcher_list
- #does_not_match?
- #expected
- #expects_call_stack_jump?
- #supports_block_expectations?

### Class/Module Index

Quicksearch

- RSpec
- RSpec::Expectations
- RSpec::Expectations::BlockExpectationTarget
- RSpec::Expectations::Configuration
- RSpec::Expectations::ExpectationHelper
- RSpec::Expectations::ExpectationNotMetError
- RSpec::Expectations::ExpectationTarget
- RSpec::Expectations::FailureAggregator
- RSpec::Expectations::LegacyMacherAdapter
- RSpec::Expectations::LegacyMatcherAdapter
- RSpec::Expectations::LegacyMatcherAdapter::RSpec1
- RSpec::Expectations::LegacyMatcherAdapter::RSpec2
- RSpec::Expectations::MultipleExpectationsNotMetError
- RSpec::Expectations::NegativeExpectationHandler
- RSpec::Expectations::PositiveExpectationHandler
- RSpec::Expectations::Syntax
- RSpec::Expectations::Version
- RSpec::Matchers
- RSpec::Matchers::AliasedMatcher
- RSpec::Matchers::AliasedMatcherWithOperatorSupport
- RSpec::Matchers::AliasedNegatedMatcher
- RSpec::Matchers::BuiltIn
- RSpec::Matchers::BuiltIn::All
- RSpec::Matchers::BuiltIn::BaseMatcher
- RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages
- RSpec::Matchers::BuiltIn::BaseMatcher::HashFormatting
- RSpec::Matchers::BuiltIn::Be
- RSpec::Matchers::BuiltIn::BeAKindOf
- RSpec::Matchers::BuiltIn::BeAnInstanceOf
- RSpec::Matchers::BuiltIn::BeBetween
- RSpec::Matchers::BuiltIn::BeComparedTo
- RSpec::Matchers::BuiltIn::BeFalsey
- RSpec::Matchers::BuiltIn::BeHelpers
- RSpec::Matchers::BuiltIn::BeNil
- RSpec::Matchers::BuiltIn::BePredicate
- RSpec::Matchers::BuiltIn::BeTruthy
- RSpec::Matchers::BuiltIn::BeWithin
- RSpec::Matchers::BuiltIn::CaptureStderr
- RSpec::Matchers::BuiltIn::CaptureStdout
- RSpec::Matchers::BuiltIn::CaptureStreamToTempfile
- RSpec::Matchers::BuiltIn::Change
- RSpec::Matchers::BuiltIn::ChangeDetails
- RSpec::Matchers::BuiltIn::ChangeFromValue
- RSpec::Matchers::BuiltIn::ChangeRelatively
- RSpec::Matchers::BuiltIn::ChangeToValue
- RSpec::Matchers::BuiltIn::Compound
- RSpec::Matchers::BuiltIn::Compound::And
- RSpec::Matchers::BuiltIn::Compound::NestedEvaluator
- RSpec::Matchers::BuiltIn::Compound::Or
- RSpec::Matchers::BuiltIn::Compound::SequentialEvaluator
- RSpec::Matchers::BuiltIn::ContainExactly
- RSpec::Matchers::BuiltIn::ContainExactly::PairingsMaximizer
- RSpec::Matchers::BuiltIn::Cover
- RSpec::Matchers::BuiltIn::EndWith
- RSpec::Matchers::BuiltIn::Eq
- RSpec::Matchers::BuiltIn::Eql
- RSpec::Matchers::BuiltIn::Equal
- RSpec::Matchers::BuiltIn::Exist
- RSpec::Matchers::BuiltIn::Exist::ExistenceTest
- RSpec::Matchers::BuiltIn::Has
- RSpec::Matchers::BuiltIn::HaveAttributes
- RSpec::Matchers::BuiltIn::Include
- RSpec::Matchers::BuiltIn::Match
- RSpec::Matchers::BuiltIn::NegativeOperatorMatcher
- RSpec::Matchers::BuiltIn::NullCapture
- RSpec::Matchers::BuiltIn::OperatorMatcher
- RSpec::Matchers::BuiltIn::Output
- RSpec::Matchers::BuiltIn::PositiveOperatorMatcher
- RSpec::Matchers::BuiltIn::RaiseError
- RSpec::Matchers::BuiltIn::RespondTo
- RSpec::Matchers::BuiltIn::Satisfy
- RSpec::Matchers::BuiltIn::SpecificValuesChange
- RSpec::Matchers::BuiltIn::StartAndEndWith
- RSpec::Matchers::BuiltIn::StartOrEndWith
- RSpec::Matchers::BuiltIn::StartWith
- RSpec::Matchers::BuiltIn::ThrowSymbol
- RSpec::Matchers::BuiltIn::YieldControl
- RSpec::Matchers::BuiltIn::YieldProbe
- RSpec::Matchers::BuiltIn::YieldSuccessiveArgs
- RSpec::Matchers::BuiltIn::YieldWithArgs
- RSpec::Matchers::BuiltIn::YieldWithNoArgs
- RSpec::Matchers::Composable
- RSpec::Matchers::DSL
- RSpec::Matchers::DSL::DefaultImplementations
- RSpec::Matchers::DSL::Macros
- RSpec::Matchers::DSL::Macros::Deprecated
- RSpec::Matchers::DSL::Matcher
- RSpec::Matchers::EnglishPhrasing
- RSpec::Matchers::ExpectedsForMultipleDiffs
- RSpec::Matchers::FailMatchers
- RSpec::Matchers::MatcherDelegator
- RSpec::Matchers::MatcherProtocol
- BasicObject
- Object

No matching classes.

# RSpec::Matchers::BuiltIn::Compound

@api private Base class for `and` and `or` compound matchers. rubocop:disable ClassLength

### Attributes

evaluator[R]

@private

matcher_1[R]

@private

matcher_2[R]

@private

### Public Class Methods

new(matcher_1, matcher_2) click to toggle source

    # File lib/rspec/matchers/built_in/compound.rb, line 11
    def initialize(matcher_1, matcher_2)
      @matcher_1 = matcher_1
      @matcher_2 = matcher_2
    end

### Public Instance Methods

description() click to toggle source

@api private @return [String]

    # File lib/rspec/matchers/built_in/compound.rb, line 26
    def description
      singleline_message(matcher_1.description, matcher_2.description)
    end

diffable?() click to toggle source

@api private @return [Boolean]

    # File lib/rspec/matchers/built_in/compound.rb, line 42
    def diffable?
      matcher_is_diffable?(matcher_1) || matcher_is_diffable?(matcher_2)
    end

does_not_match?(_actual) click to toggle source

@private

    # File lib/rspec/matchers/built_in/compound.rb, line 17
    def does_not_match?(_actual)
      raise NotImplementedError, "`expect(...).not_to matcher.#{conjunction} matcher` "              "is not supported, since it creates a bit of an ambiguity. Instead, define negated versions "              "of whatever matchers you wish to negate with `RSpec::Matchers.define_negated_matcher` and "              "use `expect(...).to matcher.#{conjunction} matcher`."
    end

expected() click to toggle source

@api private @return [RSpec::Matchers::ExpectedsForMultipleDiffs]

    # File lib/rspec/matchers/built_in/compound.rb, line 48
    def expected
      return nil unless evaluator
      ::RSpec::Matchers::ExpectedsForMultipleDiffs.for_many_matchers(diffable_matcher_list)
    end

expects_call_stack_jump?() click to toggle source

    # File lib/rspec/matchers/built_in/compound.rb, line 35
    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?() click to toggle source

    # 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

### Protected Instance Methods

diffable_matcher_list() click to toggle source

    # File lib/rspec/matchers/built_in/compound.rb, line 55
    def diffable_matcher_list
      list = []
      list.concat(diffable_matcher_list_for(matcher_1)) unless matcher_1_matches?
      list.concat(diffable_matcher_list_for(matcher_2)) unless matcher_2_matches?
      list
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.