类: RSpec::Matchers::BuiltIn::Equal 私有

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

概述

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

提供 equal 的实现。不建议直接实例化。

常量摘要

BaseMatcher 继承的常量

BaseMatcher::UNDEFINED

实例方法摘要 收起

BaseMatcher 继承的方法

#description, #expects_call_stack_jump?, #initialize, #match_unless_raises, #matches?, #supports_block_expectations?

Composable 包含的方法

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

构造函数详情

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

实例方法详情

#diffable?Boolean

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

返回值

  • (Boolean)
33
34
35
# File 'lib/rspec/matchers/built_in/equal.rb', line 33
def diffable?
  !expected_is_a_literal_singleton?
end

#failure_messageString

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

返回值

  • (String)
10
11
12
13
14
15
16
# File 'lib/rspec/matchers/built_in/equal.rb', line 10
def failure_message
  if expected_is_a_literal_singleton?
    simple_failure_message
  else
    detailed_failure_message
  end
end

#failure_message_when_negatedString

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

返回值

  • (String)
20
21
22
23
24
25
26
27
28
29
# File 'lib/rspec/matchers/built_in/equal.rb', line 20
def failure_message_when_negated
  <<-MESSAGE

expected not #{inspect_object(actual)}
 got #{inspect_object(expected)}
Compared using equal?, which compares object identity.
MESSAGE
end