Sha256: bae9f6d599b485f9fb321b7fe02b87b81c5d16ca702b4e02164f60ae54f1b852

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'
module SandthornDriverSequel
  describe EventStore do
    let(:context) { :event_store_spec }
    before(:each) { prepare_for_test context: context; prepare_for_test context: nil; }
    let(:event_store_with_context) { SandthornDriverSequel.driver_from_url url: event_store_url, context: context  }  
    let(:event_store_without_context) { SandthornDriverSequel.driver_from_url url: event_store_url }
    context("when saving in one context and retrieving in another") do
      let(:test_events) do
        e = [] 
        e << {aggregate_version: 1, event_name: "new",  event_args: {:method_name=>"new", :method_args=>[], :attribute_deltas=>[{:attribute_name=>"aggregate_id", :old_value=>nil, :new_value=>"0a74e545-be84-4506-8b0a-73e947856327"}]}}
        e << {aggregate_version: 2, event_name: "foo",  event_args: "noop"}
        e << {aggregate_version: 3, event_name: "flubber",  event_args: "noop"}
      end
      let(:aggregate_id) {"c0456e26-e29a-4f67-92fa-130b3a31a39b"}
      it "should not find them" do
        event_store_without_context.save_events test_events, aggregate_id, String
        events = event_store_without_context.get_aggregate_events aggregate_id
        expect(events.length).to eql test_events.length
        events_2 = event_store_with_context.get_aggregate_events aggregate_id
        expect(events_2.length).to eql 0
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sandthorn_driver_sequel-3.2.1 spec/event_store_with_context_spec.rb
sandthorn_driver_sequel-3.2.0 spec/event_store_with_context_spec.rb
sandthorn_driver_sequel-3.1.0 spec/event_store_with_context_spec.rb
sandthorn_driver_sequel-3.0.0 spec/event_store_with_context_spec.rb