Sha256: 0587d6e60122852937acc43809b8a81aefca6d5965ea3c7ae3f5a1702e9a10a0

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

describe 'history table in database' do
  before do
    allow(SqlMigrations::Config).to receive(:databases) { { default: {} } }
  end

  it 'should be created if it does not exist' do
    expect do
      @database = SqlMigrations::Database.new(:default, adapter: :sqlite)
    end.to output("[+] Connected to `default` database using sqlite adapter\n" \
                  "[!] Installing `sqlmigrations_schema` history table\n").to_stdout
    expect(@database.driver.table_exists?(:sqlmigrations_schema)).to be true
  end

  it 'should not be create if it exists' do
    @sqlite_db.create_table(:sqlmigrations_schema) do
      # rubocop:disable Style/SingleSpaceBeforeFirstArg
      primary_key :id
      Bignum      :time
      DateTime    :executed
      String      :name
      String      :type
      index       [:time, :type]
      # rubocop:enable Style/SingleSpaceBeforeFirstArg
    end
    expect do
      @database = SqlMigrations::Database.new(:default, adapter: :sqlite)
    end.to output("[+] Connected to `default` database using sqlite adapter\n").to_stdout
    expect(@database.driver.table_exists?(:sqlmigrations_schema)).to be true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sql_migrations-2.6.1 spec/features/history_table_spec.rb
sql_migrations-2.6.0 spec/features/history_table_spec.rb
sql_migrations-2.5.0 spec/features/history_table_spec.rb
sql_migrations-2.4.0 spec/features/history_table_spec.rb