Sha256: 8d94f84b82395c007669051eb8c217b430dfd11eccebfa374d5c90dc5a090565
Contents?: true
Size: 1 KB
Versions: 9
Compression:
Stored size: 1 KB
Contents
require File.dirname(__FILE__) + '/helper' context "Limit" do setup do @sql = User.select { |m| m.name == 'jon' } end specify "first" do conditions = { :conditions => "users.`name` = 'jon'", :limit => '1' } User.expects(:find).with(:first, conditions) @sql.first end specify "first with argument" do conditions = { :conditions => "users.`name` = 'jon'", :limit => '5' } User.expects(:find).with(:all, conditions) @sql.first(5) end specify "[] with one element" do conditions = { :conditions => "users.`name` = 'jon'", :limit => '10, 1' } User.expects(:find).with(:all, conditions) @sql[10] end specify "[] with two elements" do conditions = { :conditions => "users.`name` = 'jon'", :limit => '10, 20' } User.expects(:find).with(:all, conditions) @sql[10, 20] end specify "[] with range" do conditions = { :conditions => "users.`name` = 'jon'", :limit => '10, 10' } User.expects(:find).with(:all, conditions) @sql[10..20] end end
Version data entries
9 entries across 7 versions & 2 rubygems