Sha256: 93597120f64d7037a73913cc0ebc193e8e1ef57e7495080d6639524b6b55c724

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

require 'spec_helper'

class InitChange
  include Sandthorn::AggregateRoot
  attr_reader :foo
  def initialize foo: nil
    @foo = foo
  end
end
def change_init
  InitChange.class_eval do
    define_method :initialize, lambda { @foo = :foo }
  end
end
describe "when the initialize-method changes" do
  it "should be possible to replay anyway" do
    aggregate = InitChange.new foo: :bar
    events = aggregate.aggregate_events
    change_init
    with_change = InitChange.new
    expect(with_change.foo).to eq(:foo)
    replayed = InitChange.aggregate_build(events)
    expect(replayed.foo).to eq(:bar)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sandthorn-1.3.0 spec/initialize_signature_change_spec.rb
sandthorn-1.2.0 spec/initialize_signature_change_spec.rb
sandthorn-1.1.0 spec/initialize_signature_change_spec.rb