模块:RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages 私有

包含于
RSpec::Matchers::BuiltIn::BaseMatcher, DSL::DefaultImplementations
定义于
lib/rspec/matchers/built_in/base_matcher.rb

概述

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

提供基于 description 的默认失败消息实现。

实例方法摘要 折叠

实例方法详细信息

#failure_messageString

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

提供良好的通用失败消息。基于 description。在子类化时,如果对该失败消息不满意,通常只需要重写 description

返回值

  • (String)
213
214
215
# File 'lib/rspec/matchers/built_in/base_matcher.rb', line 213
def failure_message
  "expected #{description_of @actual} to #{description}".dup
end

#failure_message_when_negatedString

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

提供良好的通用否定失败消息。基于 description。在子类化时,如果对该失败消息不满意,通常只需要重写 description

返回值

  • (String)
222
223
224
# File 'lib/rspec/matchers/built_in/base_matcher.rb', line 222
def failure_message_when_negated
  "expected #{description_of @actual} not to #{description}".dup
end