Sha256: 5b4a929c6e32874317150f7d3afb8760b8567ca635a556205eb9e024744ef65a

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

describe 'schema 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`\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.2.1 spec/features/schema_table_spec.rb
sql_migrations-2.1.1 spec/features/schema_table_spec.rb
sql_migrations-2.1.0 spec/features/schema_table_spec.rb
sql_migrations-2.1.0.pre3 spec/features/schema_table_spec.rb