Sha256: 6ec416b53e5d57d3ec85b8fe44fb7523db3e4575ef1abcaa434b0ba2bddd890c

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 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(:users__id, :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(:users__name).first).to eql(id: 1, name: 'Jane')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rom-sql-1.3.1 spec/integration/sequel_api_spec.rb
rom-sql-1.3.0 spec/integration/sequel_api_spec.rb
rom-sql-1.2.2 spec/integration/sequel_api_spec.rb