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 271
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 285
def does_not_match?(event_proc)
  if @description_suffix
    raise NotImplementedError, "`expect { }.not_to change { }.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 295
def failure_message_when_negated
  return not_given_a_block_failure unless Proc === @event_proc
  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 278
def to(value)
  @expected_after     = value
  @description_suffix = " to #{description_of value}"
  self
end