aboutsummaryrefslogtreecommitdiffstats
path: root/spec/arel/unit/relations/take_spec.rb
blob: dca78060571fdded0a117c95be0f36b992585a8e (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 Arel
  describe Take do
    before do
      @relation = Table.new(:users)
      @taken = 4
    end

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