class RSpec::Matchers::BuiltIn::ChangeFromValue

@api private Used to specify a change from a specific value (and, optionally, to a specific value).

Public Class Methods

# File rspec-expectations/lib/rspec/matchers/built_in/change.rb, line 264
def initialize(change_details, expected_before)
  @description_suffix = nil
  super(change_details, expected_before, MATCH_ANYTHING)
end

Public Instance Methods

@private

# File rspec-expectations/lib/rspec/matchers/built_in/change.rb, line 278
def does_not_match?(event_proc)
  if @description_suffix
    raise NotImplementedError, "Using a negated form of the `change` matcher " \
                               "with `to()` is not supported."
  end

  perform_change(event_proc) && !@change_details.changed? && @matches_before
end

@private

# File rspec-expectations/lib/rspec/matchers/built_in/change.rb, line 288
def failure_message_when_negated
  return before_value_failure unless @matches_before
  did_change_failure
end

@api public Specifies the new value you expect.

# File rspec-expectations/lib/rspec/matchers/built_in/change.rb, line 271
def to(value)
  @expected_after     = value
  @description_suffix = " to #{description_of value}"
  self
end