Sha256: 6c52cd611bad99031232ae5ba1fd222d10e12ca269907423affb52c3c733c7dc

Contents?: true

Size: 756 Bytes

Versions: 9

Compression:

Stored size: 756 Bytes

Contents

RSpec.describe ROM::Relation, '#qualified' do
  subject(:relation) { relations[:users] }

  include_context 'users and tasks'

  with_adapters do
    it 'qualifies all attributes' do
      qualified = relation.qualified

      expect(qualified.schema.all?(&:qualified)).to be(true)
    end

    it 'qualifies virtual attributes' do
      qualified = relation.
                    left_join(:tasks, tasks[:user_id].qualified => relation[:id].qualified).
                    select(:id, tasks[:id].func { int::count(id).as(:count) }).
                    qualified.
                    group(:id)

      expect(qualified.schema.all?(&:qualified)).to be(true)

      expect(qualified.to_a).to eql([{ id: 1, count: 1 }, { id: 2, count: 1 }])
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rom-sql-1.3.5 spec/unit/relation/qualified_spec.rb
rom-sql-1.3.4 spec/unit/relation/qualified_spec.rb
rom-sql-2.0.0.beta2 spec/unit/relation/qualified_spec.rb
rom-sql-2.0.0.beta1 spec/unit/relation/qualified_spec.rb
rom-sql-1.3.3 spec/unit/relation/qualified_spec.rb
rom-sql-1.3.2 spec/unit/relation/qualified_spec.rb
rom-sql-1.3.1 spec/unit/relation/qualified_spec.rb
rom-sql-1.3.0 spec/unit/relation/qualified_spec.rb
rom-sql-1.2.2 spec/unit/relation/qualified_spec.rb