Sha256: 12f8ea7ed815ab5cf50e77fe9a6d913e39dca908cdcd62795e0198230d1d2310

Contents?: true

Size: 1.06 KB

Versions: 16

Compression:

Stored size: 1.06 KB

Contents

RSpec.describe 'ROM::SQL::Schema::SqliteInferrer', :sqlite do
  include_context 'database setup'

  before do
    inferrable_relations.concat %i(test_inferrence)
  end

  before do
    conn.create_table :test_inferrence do
      tinyint :tiny
      int8 :big
      bigint :long
      column :dummy, nil
      boolean :flag, null: false
    end
  end

  before do
    conf.relation(:test_inferrence) do
      schema(infer: true)
    end
  end

  let(:schema) { container.relations[:test_inferrence].schema }
  let(:source) { container.relations[:test_inferrence].name }

  it 'can infer attributes for dataset' do
    expect(schema.to_h).
      to eql(
           tiny: ROM::SQL::Types::Int.optional.meta(name: :tiny, source: source),
           big: ROM::SQL::Types::Int.optional.meta(name: :big, source: source),
           long: ROM::SQL::Types::Int.optional.meta(name: :long, source: source),
           dummy: ROM::SQL::Types::SQLite::Object.optional.meta(name: :dummy, source: source),
           flag: ROM::SQL::Types::Bool.meta(name: :flag, source: source)
         )
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rom-sql-1.3.5 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.3.4 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-2.0.0.beta2 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-2.0.0.beta1 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.3.3 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.3.2 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.3.1 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.3.0 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.2.2 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.2.1 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.2.0 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.1.2 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.1.1 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.1.0 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.0.3 spec/integration/schema/inferrer/sqlite_spec.rb
rom-sql-1.0.2 spec/integration/schema/inferrer/sqlite_spec.rb