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

Inherits:
BaseMatcher show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/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

Constants inherited from BaseMatcher

BaseMatcher::UNDEFINED

Instance Attribute Summary collapse

Attributes inherited from BaseMatcher

#actual, #matcher_name, #rescued_exception

Instance Method Summary collapse

Methods inherited from BaseMatcher

#actual_formatted, #expected_formatted, #match_unless_raises, matcher_name, #matches?

Methods included from BaseMatcher::DefaultFailureMessages

#failure_message, #failure_message_when_negated, has_default_failure_messages?

Methods included from BaseMatcher::HashFormatting

improve_hash_formatting

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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/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 Attribute Details

#evaluatorObject (readonly)

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.



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/compound.rb', line 8

def evaluator
  @evaluator
end

#matcher_1Object (readonly)

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.



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/compound.rb', line 8

def matcher_1
  @matcher_1
end

#matcher_2Object (readonly)

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.



8
9
10
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/compound.rb', line 8

def matcher_2
  @matcher_2
end

Instance Method Details

#descriptionString

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:



25
26
27
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/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.

Returns:

  • (Boolean)


49
50
51
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/compound.rb', line 49

def diffable?
  matcher_is_diffable?(matcher_1) || matcher_is_diffable?(matcher_2)
end

#does_not_match?(_actual) ⇒ 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.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


16
17
18
19
20
21
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/compound.rb', line 16

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

#expectedRSpec::Matchers::ExpectedsForMultipleDiffs

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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/compound.rb', line 55

def expected
  return nil unless evaluator
  ::RSpec::Matchers::ExpectedsForMultipleDiffs.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.

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/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.

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/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.

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/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