aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation/unit/relations/skip_spec.rb
blob: 219bfdd80ef48a227fb8d6432bedf1503788b5ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper')

module ActiveRelation
  describe Skip do
    before do
      @relation = Table.new(:users)
      @skipped = 4
    end

    describe '#to_sql' do
      it "manufactures sql with limit and offset" do
        Skip.new(@relation, @skipped).to_s.should be_like("
          SELECT `users`.`id`, `users`.`name`
          FROM `users`
          OFFSET #{@skipped}
        ")
      end
    end
  end
end