Sha256: 73e571ac956767765ea756cee43c368c0662c7423e3f913d4a2121dca0c8cd1a

Contents?: true

Size: 779 Bytes

Versions: 6

Compression:

Stored size: 779 Bytes

Contents

RSpec.describe ROM::Relation, '#qualified_columns' do
  subject(:relation) { container.relations.users }

  include_context 'users and tasks'

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

      def sorted
        order(:id)
      end
    end
  end

  with_adapters do
    it 'returns qualified column names' do
      columns = relation.sorted.prefix(:user).qualified_columns

      expect(columns).to eql([Sequel.qualify(:users, :id).as(:user_id),
                              Sequel.qualify(:users, :name).as(:user_name)])
    end

    it 'returns projected qualified column names' do
      columns = relation.sorted.project(:id).prefix(:user).qualified_columns

      expect(columns).to eql([Sequel.qualify(:users, :id).as(:user_id)])
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rom-sql-1.3.5 spec/unit/relation/qualified_columns_spec.rb
rom-sql-1.3.4 spec/unit/relation/qualified_columns_spec.rb
rom-sql-2.0.0.beta2 spec/unit/relation/qualified_columns_spec.rb
rom-sql-2.0.0.beta1 spec/unit/relation/qualified_columns_spec.rb
rom-sql-1.3.3 spec/unit/relation/qualified_columns_spec.rb
rom-sql-1.3.2 spec/unit/relation/qualified_columns_spec.rb