Sha256: f8af0c681cec49c1c68f86c37693366940c0e4791a46d7e838c9929935af247e

Contents?: true

Size: 813 Bytes

Versions: 1

Compression:

Stored size: 813 Bytes

Contents

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

  before do
    conn.drop_table?(:test_inferrence)

    conn.create_table :test_inferrence do
      tinyint :tiny
      int8 :big
    end
  end

  after do
    conn.drop_table?(:test_inferrence)
  end

  let(:dataset) { :test_inferrence }

  let(:schema) { container.relations[dataset].schema }

  before do
    dataset = self.dataset
    conf.relation(dataset) do
      schema(dataset, infer: true)
    end
  end

  it 'can infer attributes for dataset' do
    source = container.relations[:test_inferrence].name

    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),
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rom-sql-1.0.0.beta3 spec/integration/schema/inferrer/sqlite_spec.rb