Sha256: 735ba260b44d34198d52ece32fa9f15d3bab0fdd9fb260492d8c4b8b342af947

Contents?: true

Size: 641 Bytes

Versions: 23

Compression:

Stored size: 641 Bytes

Contents

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

  include_context 'users and tasks'

  with_adapters do
    it 'appends new columns' do
      selected = relation.select(:id).select_append(:title)

      expect(selected.schema.map(&:name)).to eql(%i[id title])
      expect(selected.first).to eql(id: 1, title: "Joe's task")
    end

    it 'supports blocks' do
      selected = relation.select(:id).select_append { string::upper(title).as(:title) }

      expect(selected.schema.map(&:name)).to eql(%i[id title])
      expect(selected.first).to eql(id: 1, title: "JOE'S TASK")
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rom-sql-1.3.5 spec/unit/relation/select_append_spec.rb
rom-sql-1.3.4 spec/unit/relation/select_append_spec.rb
rom-sql-2.0.0.beta2 spec/unit/relation/select_append_spec.rb
rom-sql-2.0.0.beta1 spec/unit/relation/select_append_spec.rb
rom-sql-1.3.3 spec/unit/relation/select_append_spec.rb
rom-sql-1.3.2 spec/unit/relation/select_append_spec.rb
rom-sql-1.3.1 spec/unit/relation/select_append_spec.rb
rom-sql-1.3.0 spec/unit/relation/select_append_spec.rb
rom-sql-1.2.2 spec/unit/relation/select_append_spec.rb
rom-sql-1.2.1 spec/unit/relation/select_append_spec.rb
rom-sql-1.2.0 spec/unit/relation/select_append_spec.rb
rom-sql-1.1.2 spec/unit/relation/select_append_spec.rb
rom-sql-1.1.1 spec/unit/relation/select_append_spec.rb
rom-sql-1.1.0 spec/unit/relation/select_append_spec.rb
rom-sql-1.0.3 spec/unit/relation/select_append_spec.rb
rom-sql-1.0.2 spec/unit/relation/select_append_spec.rb
rom-sql-1.0.1 spec/unit/relation/select_append_spec.rb
rom-sql-1.0.0 spec/unit/relation/select_append_spec.rb
rom-sql-1.0.0.rc2 spec/unit/relation/select_append_spec.rb
rom-sql-1.0.0.rc1 spec/unit/relation/select_append_spec.rb