Sha256: 27f198eba528735980bad3c2c289319c8761ff475dd7430235e84ef8788cc0c7

Contents?: true

Size: 511 Bytes

Versions: 7

Compression:

Stored size: 511 Bytes

Contents

require 'spec_helper'

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

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

    it 'auto-projects a relation with renamed columns using provided prefix' do
      expect(relations[:users].schema.prefix(:user).(relations[:users]).dataset.sql)
        .to eql('SELECT "id" AS "user_id", "name" AS "user_name" FROM "users" ORDER BY "users"."id"')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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