Sha256: c8eef3ff5799dc83fc4e368628a8a41c7fee7de3fd35cd68de561b2279b51e4f

Contents?: true

Size: 832 Bytes

Versions: 13

Compression:

Stored size: 832 Bytes

Contents

require File.expand_path("../spec_helper", __FILE__)

module Euston
  describe 'aggregate root' do
    context 'duplicate command consumption' do
      let(:aggregate) { Sample::Widget.new }
      let(:aggregate2) { Sample::Widget.new }
      let(:command) { { :headers => CommandHeaders.new(Euston.uuid.generate, :create_widget, 1),
                        :body => { :id => Euston.uuid.generate } } }

      it 'does not handle the same command twice' do
        aggregate.consume_command command[:headers], command[:body]
        aggregate.uncommitted_events.should have(1).item

        aggregate.uncommitted_events.each { |e| aggregate2.replay_event e.headers, e.body }

        aggregate2.consume_command command[:headers], command[:body]
        aggregate2.uncommitted_events.should have(0).items
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
euston-1.2.3 spec/aggregate_root_spec.rb
euston-1.2.3-java spec/aggregate_root_spec.rb
euston-1.2.2 spec/aggregate_root_spec.rb
euston-1.2.2-java spec/aggregate_root_spec.rb
euston-1.2.1 spec/aggregate_root_spec.rb
euston-1.2.1-java spec/aggregate_root_spec.rb
euston-1.2.0 spec/aggregate_root_spec.rb
euston-1.2.0-java spec/aggregate_root_spec.rb
euston-1.1.0 spec/aggregate_root_spec.rb
euston-1.1.0-java spec/aggregate_root_spec.rb
euston-1.0.1 spec/aggregate_root_spec.rb
euston-1.0.1-java spec/aggregate_root_spec.rb
euston-1.0.0 spec/aggregate_root_spec.rb