类: RSpec::Matchers::BuiltIn::ContainExactly 私有

继承
BaseMatcher
  • Object
显示所有
定义于
lib/rspec/matchers/built_in/contain_exactly.rb

概述

此类是私有 API 的一部分。 应尽可能避免使用此类,因为它将来可能会被移除或更改。

rubocop:disable Metrics/ClassLength 提供了 contain_exactlymatch_array 的实现。不打算直接实例化。

常量摘要

BaseMatcher 继承的常量

BaseMatcher::UNDEFINED

实例方法摘要 折叠

BaseMatcher 继承的方法

#diffable?, #expects_call_stack_jump?, #initialize, #match_unless_raises, #supports_block_expectations?

Composable 包含的方法

#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?

构造函数详情

此类从 RSpec::Matchers::BuiltIn::BaseMatcher 继承了一个构造函数

实例方法详情

#descriptionString

此方法是私有 API 的一部分。 应尽可能避免使用此方法,因为它将来可能会被移除或更改。

返回

  • (String)
29
30
31
32
# File 'lib/rspec/matchers/built_in/contain_exactly.rb', line 29
def description
  list = EnglishPhrasing.list(surface_descriptions_in(expected))
  "contain exactly#{list}"
end

#failure_messageString

此方法是私有 API 的一部分。 应尽可能避免使用此方法,因为它将来可能会被移除或更改。

返回

  • (String)
11
12
13
14
15
16
17
18
# File 'lib/rspec/matchers/built_in/contain_exactly.rb', line 11
def failure_message
  if Array === actual
    generate_failure_message
  else
    "expected a collection that can be converted to an array with " \
    "`#to_ary` or `#to_a`, but got #{actual_formatted}"
  end
end

#failure_message_when_negatedString

此方法是私有 API 的一部分。 应尽可能避免使用此方法,因为它将来可能会被移除或更改。

返回

  • (String)
22
23
24
25
# File 'lib/rspec/matchers/built_in/contain_exactly.rb', line 22
def failure_message_when_negated
  list = EnglishPhrasing.list(surface_descriptions_in(expected))
  "expected #{actual_formatted} not to contain exactly#{list}"
end

#matches?(actual) ⇒Boolean

此方法是私有 API 的一部分。 应尽可能避免使用此方法,因为它将来可能会被移除或更改。

返回

  • (Boolean)
34
35
36
37
38
39
40
# File 'lib/rspec/matchers/built_in/contain_exactly.rb', line 34
def matches?(actual)
  @pairings_maximizer = nil
  @best_solution = nil
  @extra_items = nil
  @missing_items = nil
  super(actual)
end