类: RSpec::Matchers::BuiltIn::Compound 私有

继承
BaseMatcher
  • Object
显示全部
定义于
lib/rspec/matchers/built_in/compound.rb

概览

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

andor 复合匹配器的基类。

直接已知子类

And, Or

在命名空间下定义

类: And, NestedEvaluator, Or, SequentialEvaluator

常量摘要

BaseMatcher 继承的常量

BaseMatcher::UNDEFINED

实例方法摘要 折叠

BaseMatcher 继承的方法

#match_unless_raises, #matches?

BaseMatcher::DefaultFailureMessages 包含的方法

#failure_message, #failure_message_when_negated

Composable 包含的方法

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

构造函数详情

#initialize(matcher_1, matcher_2) ⇒Compound

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

返回 Compound 的新实例。

10
11
12
13
# File 'lib/rspec/matchers/built_in/compound.rb', line 10
def initialize(matcher_1, matcher_2)
  @matcher_1 = matcher_1
  @matcher_2 = matcher_2
end

实例方法详情

#descriptionString

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

返回

  • (String)
25
26
27
# File 'lib/rspec/matchers/built_in/compound.rb', line 25
def description
  "#{matcher_1.description} #{conjunction} #{matcher_2.description}"
end

#diffable?Boolean

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

返回

  • (Boolean)
49
50
51
# File 'lib/rspec/matchers/built_in/compound.rb', line 49
def diffable?
  matcher_is_diffable?(matcher_1) || matcher_is_diffable?(matcher_2)
end

#expectedRSpec::Matchers::MultiMatcherDiff

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

55
56
57
58
# File 'lib/rspec/matchers/built_in/compound.rb', line 55
def expected
  return nil unless evaluator
  ::RSpec::Matchers::MultiMatcherDiff.for_many_matchers(diffable_matcher_list)
end

#expects_call_stack_jump?Boolean

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

返回

  • (Boolean)
42
43
44
45
# File '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

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

返回

  • (Boolean)
30
31
32
33
# File '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

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

返回

  • (Boolean)
36
37
38
39
# File '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