Class: RSpec::Matchers::BuiltIn::Include Private

Inherits:
BaseMatcher show all
Includes:
CountExpectation
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/include.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 ‘include`. Not intended to be instantiated directly.

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 included from CountExpectation

#at_least, #at_most, #exactly, #once, #thrice, #times, #twice

Methods inherited from BaseMatcher

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

Methods included from BaseMatcher::DefaultFailureMessages

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(*expecteds) ⇒ Include

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



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

def initialize(*expecteds)
  @expecteds = expecteds
end

Instance Attribute Details

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



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/include.rb', line 12

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



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/include.rb', line 43

def description
  improve_hash_formatting("include#{readable_list_of(expecteds)}#{count_expectation_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)


61
62
63
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/include.rb', line 61

def diffable?
  !diff_would_wrongly_highlight_matched_item?
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)


32
33
34
35
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/include.rb', line 32

def does_not_match?(actual)
  check_actual?(actual) &&
    if check_expected_count?
      !expected_count_matches?(count_inclusions)
    else
      perform_match { |v| !v }
    end
end

#expectedArray, Hash

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:



67
68
69
70
71
72
73
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/include.rb', line 67

def expected
  if expecteds.one? && Hash === expecteds.first
    expecteds.first
  else
    expecteds
  end
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:



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/include.rb', line 49

def failure_message
  format_failure_message("to") { super }
end

#failure_message_when_negatedString

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:



55
56
57
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/include.rb', line 55

def failure_message_when_negated
  format_failure_message("not to") { super }
end

#matches?(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)


21
22
23
24
25
26
27
28
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-expectations-3.12.2/lib/rspec/matchers/built_in/include.rb', line 21

def matches?(actual)
  check_actual?(actual) &&
    if check_expected_count?
      expected_count_matches?(count_inclusions)
    else
      perform_match { |v| v }
    end
end