类: RSpec::Matchers::BuiltIn::DynamicPredicate 私有

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

概述

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

提供动态谓词匹配器的实现。 不建议直接继承。

直接已知子类

BePredicate, Has

常量摘要

BaseMatcher 继承的常量

BaseMatcher::UNDEFINED

实例方法摘要 收起

BaseMatcher 继承的方法

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

Composable 包含的方法

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

构造函数详情

#initialize(method_name, *args, &block) ⇒DynamicPredicate

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

返回一个新的 DynamicPredicate 实例。

10
11
12
# File 'lib/rspec/matchers/built_in/has.rb', line 10
def initialize(method_name, *args, &block)
  @method_name, @args, @block = method_name, args, block
end

实例方法详情

#descriptionString

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

返回

  • (String)
43
44
45
# File 'lib/rspec/matchers/built_in/has.rb', line 43
def description
  "#{method_description}#{args_to_sentence}"
end

#failure_messageString

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

返回

  • (String)
31
32
33
# File 'lib/rspec/matchers/built_in/has.rb', line 31
def failure_message
  failure_message_expecting(true)
end

#failure_message_when_negatedString

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

返回

  • (String)
37
38
39
# File 'lib/rspec/matchers/built_in/has.rb', line 37
def failure_message_when_negated
  failure_message_expecting(false)
end