aboutsummaryrefslogtreecommitdiffstats
path: root/spec/active_relation/unit/relations/take_spec.rb
blob: 8c13732258c934c0cee798383b1ab3bb1133862f (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 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