类: RSpec::Matchers::BuiltIn::ChangeToValue 私有

继承
SpecificValuesChange 显示所有
定义在
lib/rspec/matchers/built_in/change.rb

概述

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

用于指定对特定值(以及可选地,从特定值)的更改。

常量摘要

BaseMatcher 继承的常量

BaseMatcher::UNDEFINED

实例方法摘要 收起

BaseMatcher 继承的方法

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

BaseMatcher::DefaultFailureMessages 包含的方法

#failure_message, #failure_message_when_negated

Composable 包含的方法

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

构造函数详细信息

#initialize(change_details, expected_after) ⇒ChangeToValue

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

返回 ChangeToValue 的新实例。

312
313
314
315
# File 'lib/rspec/matchers/built_in/change.rb', line 312
def initialize(change_details, expected_after)
  @description_suffix = nil
  super(change_details, MATCH_ANYTHING, expected_after)
end

实例方法详细信息

#from(value) ⇒Object

指定原始值。

319
320
321
322
323
# File 'lib/rspec/matchers/built_in/change.rb', line 319
def from(value)
  @expected_before    = value
  @description_suffix = " from #{description_of value}"
  self
end