Class: RSpec::Matchers::BuiltIn::All 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/all.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.

Provides the implementation for ‘all`. Not intended to be instantiated directly.

Constant Summary

Constants inherited from BaseMatcher

BaseMatcher::UNDEFINED

Instance Attribute Summary collapse

Attributes inherited from BaseMatcher

#actual, #expected, #matcher_name, #rescued_exception

Instance Method Summary collapse

Methods inherited from BaseMatcher

#actual_formatted, #diffable?, #expected_formatted, #expects_call_stack_jump?, #match_unless_raises, matcher_name, #matches?, #supports_block_expectations?, #supports_value_expectations?

Methods included from BaseMatcher::DefaultFailureMessages

#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) ⇒ All

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 All.



11
12
13
14
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/all.rb', line 11

def initialize(matcher)
  @matcher = matcher
  @failed_objects = {}
end

Instance Attribute Details

#failed_objectsObject (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.



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

def failed_objects
  @failed_objects
end

#matcherObject (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.



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

def matcher
  @matcher
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:



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/all.rb', line 37

def description
  improve_hash_formatting "all #{description_of matcher}"
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)


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

def does_not_match?(_actual)
  raise NotImplementedError, '`expect().not_to all( matcher )` is not supported.'
end

#failure_messageString

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:



23
24
25
26
27
28
29
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/all.rb', line 23

def failure_message
  unless iterable?
    return "#{improve_hash_formatting(super)}, but was not iterable"
  end

  all_messages = [improve_hash_formatting(super)]
  failed_objects.each do |index, matcher_failure_message|
    all_messages << failure_message_for_item(index, matcher_failure_message)
  end
  all_messages.join("\n\n")
end