Sha256: ace5d14c5009539b6d065925f3d4751ca271e0d37c61d08a54e8c1566add57fb

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

module SandthornDriverSequel
  describe Migration do
    def check_tables context = nil
      events = :events
      aggregates = :aggregates
      
      if context
        events = "#{context}_#{events}".to_sym
        aggregates = "#{context}_#{aggregates}".to_sym
      
      end
      migration.driver.execute do |db|
        expect(db.table_exists? events).to be_truthy, "expected table :#{events} to exist, but it didn't"
        expect(db.table_exists? aggregates).to be_truthy, "expected table :#{aggregates} to exist, but it didn't"
      
      end
    end
    let(:migration) { Migration.new url: event_store_url, context: context  }
    before(:each) { migration.migrate! }
    context "when default (nil) eventstore contex" do
      let(:context) { nil }
      it "should create the tables events and aggregates" do
        check_tables
      end
    end
    context "when specifying context" do
      let(:context) { :another_domain }
      it "should create the tables events and aggregates" do
        check_tables context
      end
    end

    context "when migrating a connection" do
      let(:migration) { Migration.new connection: Sequel.sqlite, context: context }
      let(:context) { :some_domain }
      it "should create the tables events and aggregates" do
        check_tables context
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sandthorn_driver_sequel-4.1.0 spec/migration_specifying_domain_spec.rb
sandthorn_driver_sequel-4.0.0 spec/migration_specifying_domain_spec.rb