Sha256: 36a8ac5727c07308d968f9e5e19269f7e2db0f194f4a3a979dbaaca1d8b68bd2

Contents?: true

Size: 608 Bytes

Versions: 7

Compression:

Stored size: 608 Bytes

Contents

require 'spec_helper'

RSpec.describe ROM::SQL::Schema, '#call' do
  include_context 'database setup'

  with_adapters :postgres do
    before do
      conf.relation(:users) do
        schema(infer: true)
      end
    end

    let(:schema) { relations[:users].schema }

    it 'auto-projects a relation' do
      expect(schema.(relations[:users]).dataset.sql).to eql('SELECT "id", "name" FROM "users" ORDER BY "users"."id"')
    end

    it 'maintains schema' do
      projected = relations[:users].schema.project(:name)
      expect(projected.(relations[:users]).schema).to be(projected)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rom-sql-1.0.1 spec/integration/schema/call_spec.rb
rom-sql-1.0.0 spec/integration/schema/call_spec.rb
rom-sql-1.0.0.rc2 spec/integration/schema/call_spec.rb
rom-sql-1.0.0.rc1 spec/integration/schema/call_spec.rb
rom-sql-1.0.0.beta3 spec/integration/schema/call_spec.rb
rom-sql-1.0.0.beta2 spec/integration/schema/call_spec.rb
rom-sql-1.0.0.beta1 spec/integration/schema/call_spec.rb