Sha256: 74934ebd045ed32e80d2ced63ace6115c569e63bdea549280ab1a14e418d19ed

Contents?: true

Size: 768 Bytes

Versions: 5

Compression:

Stored size: 768 Bytes

Contents

require 'test_helpers'
describe "Migrations with a Sequel adapter" do

  let(:db){
    Alf.database("#{Alf::Sequel::Adapter.sqlite_protocol}:memory", opts)
  }

  context 'when no migration folder is set' do

    let(:opts){ {} }

    it 'fails with a clear message' do
      lambda{
        db.connect{|conn| conn.migrate! }
      }.should raise_error(Alf::ConfigError, /Migrations folder not set/)
    end
  end

  context 'when a migration folder is set' do

    let(:opts){
      { migrations_folder: fixtures_folder/"suppliers-and-parts/migrations" }
    }

    it 'runs the migrations' do
      db.connect do |conn|
        conn.knows?(:suppliers).should be_false
        conn.migrate!
        conn.knows?(:suppliers).should be_true
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.16.3 spec/migrations/test_sequel_migration.rb
alf-0.16.2 spec/migrations/test_sequel_migration.rb
alf-0.16.1 spec/migrations/test_sequel_migration.rb
alf-0.16.0 spec/migrations/test_sequel_migration.rb
alf-0.15.0 spec/migrations/test_sequel_migration.rb