class Matchi::Change::From

*Change from to* wrapper.

Public Class Methods

new(expected, &state) click to toggle source

Initialize the wrapper with an object and a block.

@example

require "matchi/change/from"

object = "foo"

Matchi::Change::From.new("foo") { object.to_s }

@param expected [#object_id] An expected initial value. @param state [Proc] A block of code to execute to get the

state of the object.
# File lib/matchi/change/from.rb, line 21
def initialize(expected, &state)
  @expected = expected
  @state    = state
end

Public Instance Methods

to(expected_new_value) click to toggle source

Specifies the new value to expect.

@example

require "matchi/change/from"

object = "foo"

change_from_wrapper = Matchi::Change::From.new("foo") { object.to_s }
change_from_wrapper.to("FOO")

@param expected_new_value [#object_id] The new value to expect.

@return [#matches?] A *change from to* matcher.

# File lib/matchi/change/from.rb, line 39
def to(expected_new_value)
  To.new(@expected, expected_new_value, &@state)
end