Sha256: 1d62f40ac3ddad0263a3d750d76e27ff484707f6acf93a2147754d2f50b9132e

Contents?: true

Size: 599 Bytes

Versions: 16

Compression:

Stored size: 599 Bytes

Contents

require 'spec_helper'

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

  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

16 entries across 16 versions & 1 rubygems

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