Sha256: 75734c9adea269e1cda218af1a28c6f223fc96a6a65b562fe297679933abb9f8

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

require 'spec_helper'

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

  let(:users) { relations[: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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-sql-1.0.3 spec/integration/sequel_api_spec.rb
rom-sql-1.0.2 spec/integration/sequel_api_spec.rb