Class: RSpec::Matchers::BuiltIn::All Private

Inherits:
BaseMatcher show all
Defined in:
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

Constant Summary

Constants inherited from BaseMatcher

BaseMatcher::UNDEFINED

Instance Method Summary (collapse)

Methods inherited from BaseMatcher

#diffable?, #expects_call_stack_jump?, #failure_message_when_negated, #match_unless_raises, #matches?, #supports_block_expectations?

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

- (All) initialize(matcher)

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/rspec/matchers/built_in/all.rb', line 11

def initialize(matcher)
  @matcher = matcher
  @failed_objects = {}
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)


33
34
35
36
# File 'lib/rspec/matchers/built_in/all.rb', line 33

def description
  described_items = surface_descriptions_in(matcher)
  improve_hash_formatting "all#{to_sentence(described_items)}"
end

- (String) failure_message

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
26
27
28
29
# File 'lib/rspec/matchers/built_in/all.rb', line 23

def failure_message
  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