类: RSpec::Mocks::VerifyingMessageExpectation 私有

继承
MessageExpectation 显示全部
定义在
lib/rspec/mocks/verifying_message_expectation.rb

概述

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

一种消息预期,它了解正在预期的消息的实际实现,以便它可以验证任何预期是否具有有效的参数。

实例属性摘要 折叠

实例方法摘要 折叠

MessageExpectation 继承的方法

#and_call_original, #and_invoke, #and_raise, #and_return, #and_throw, #and_wrap_original, #and_yield, #at_least, #at_most, #exactly, #never, #once, #ordered, #thrice, #times, #to_s, #twice

构造函数详细信息

#initialize(*args) ⇒VerifyingMessageExpectation

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

返回 VerifyingMessageExpectation 的新实例。

20
21
22
# File 'lib/rspec/mocks/verifying_message_expectation.rb', line 20
def initialize(*args)
  super
end

实例属性详细信息

#method_referenceObject

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

这里使用了一种间接级别,而不是直接传递方法本身,因为方法查找很昂贵,我们只希望在实际需要时才执行。

从概念上讲,方法引用作为构造函数参数更有意义,因为它应该是不可变的,但将对象分块构建要简单得多,所以目前它保留为访问器。

18
19
20
# File 'lib/rspec/mocks/verifying_message_expectation.rb', line 18
def method_reference
  @method_reference
end