Sha256: db3734e61e04f4bd9c9171e12084928d2cab5dc90fa0170b194e56d7b5abc0f8

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

module SandthornDriverSequel
  describe Migration do
    def check_tables context = nil
      events = :events
      aggregates = :aggregates
      snapshots = :snapshots
      if context
        events = "#{context}_#{events}".to_sym
        aggregates = "#{context}_#{aggregates}".to_sym
        snapshots = "#{context}_#{snapshots}".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"
        expect(db.table_exists? snapshots).to be_truthy, "expected table :#{snapshots} 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, aggregates and snapshots" do
        check_tables
      end
    end
    context "when specifying context" do
      let(:context) { :another_domain }
      it "should create the tables events, aggregates and snapshots" do
        check_tables context
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sandthorn_driver_sequel-3.1.0 spec/migration_specifying_domain_spec.rb
sandthorn_driver_sequel-3.0.0 spec/migration_specifying_domain_spec.rb
sandthorn_driver_sequel-2.1.1 spec/migration_specifying_domain_spec.rb
sandthorn_driver_sequel-2.1.0 spec/migration_specifying_domain_spec.rb