Sha256: a163aca288a5517c1b4fd38fa9c38b55341066871f021b276de0f6d42f0a6c93

Contents?: true

Size: 865 Bytes

Versions: 6

Compression:

Stored size: 865 Bytes

Contents

require 'spec_helper'

RSpec.describe 'Using legacy sequel api', :sqlite do
  include_context 'users'

  before do
    conf.relation(:users) do
      include ROM::SQL::Relation::SequelAPI
    end

    users.insert(name: 'Jane')
  end

  describe '#select' do
    it 'selects columns' do
      expect(users.select(Sequel.qualify(:users, :id), Sequel.qualify(:users, :name)).first).
        to eql(id: 1, name: 'Jane')
    end

    it 'supports legacy blocks' do
      expect(users.select { count(id).as(:count) }.group(:id).first).to eql(count: 1)
    end
  end

  describe '#where' do
    it 'restricts relation' do
      expect(users.where(name: 'Jane').first).to eql(id: 1, name: 'Jane')
    end
  end

  describe '#order' do
    it 'orders relation' do
      expect(users.order(Sequel.qualify(:users, :name)).first).to eql(id: 1, name: 'Jane')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rom-sql-1.3.5 spec/integration/sequel_api_spec.rb
rom-sql-1.3.4 spec/integration/sequel_api_spec.rb
rom-sql-2.0.0.beta2 spec/integration/sequel_api_spec.rb
rom-sql-2.0.0.beta1 spec/integration/sequel_api_spec.rb
rom-sql-1.3.3 spec/integration/sequel_api_spec.rb
rom-sql-1.3.2 spec/integration/sequel_api_spec.rb