./test/enumerable_test.rb in ambition-0.1.4 vs ./test/enumerable_test.rb in ambition-0.1.5

- old
+ new

@@ -1,26 +1,26 @@ require File.dirname(__FILE__) + '/helper' context "Each" do specify "simple ==" do - hash = { :conditions => "users.`age` = 21" } + hash = { :conditions => "users.age = 21" } User.expects(:find).with(:all, hash).returns([]) User.select { |m| m.age == 21 }.each do |user| puts user.name end end specify "limit and conditions" do - hash = { :limit => '5', :conditions => "users.`age` = 21" } + hash = { :limit => '5', :conditions => "users.age = 21" } User.expects(:find).with(:all, hash).returns([]) User.select { |m| m.age == 21 }.first(5).each do |user| puts user.name end end specify "limit and conditions and order" do - hash = { :limit => '5', :conditions => "users.`age` = 21", :order => 'users.name' } + hash = { :limit => '5', :conditions => "users.age = 21", :order => 'users.name' } User.expects(:find).with(:all, hash).returns([]) User.select { |m| m.age == 21 }.sort_by { |m| m.name }.first(5).each do |user| puts user.name end end @@ -34,25 +34,25 @@ end end context "Enumerable Methods" do specify "map" do - hash = { :conditions => "users.`age` = 21" } + hash = { :conditions => "users.age = 21" } User.expects(:find).with(:all, hash).returns([]) User.select { |m| m.age == 21 }.map { |u| u.name } end specify "each_with_index" do - hash = { :conditions => "users.`age` = 21" } + hash = { :conditions => "users.age = 21" } User.expects(:find).with(:all, hash).returns([]) User.select { |m| m.age == 21 }.each_with_index do |user, i| puts "#{i}: #{user.name}" end end specify "any?" do - User.expects(:count).with(:conditions => "users.`age` > 21").returns(1) + User.expects(:count).with(:conditions => "users.age > 21").returns(1) User.any? { |u| u.age > 21 }.should == true end specify "all?" do User.expects(:count).at_least_once.returns(10, 20) @@ -61,21 +61,21 @@ User.expects(:count).at_least_once.returns(10, 10) User.all? { |u| u.age > 21 }.should == true end specify "empty?" do - User.expects(:count).with(:conditions => "users.`age` > 21").returns(1) + User.expects(:count).with(:conditions => "users.age > 21").returns(1) User.select { |u| u.age > 21 }.empty?.should.equal false - User.expects(:count).with(:conditions => "users.`age` > 21").returns(0) + User.expects(:count).with(:conditions => "users.age > 21").returns(0) User.select { |u| u.age > 21 }.empty?.should.equal true end specify "entries" do User.expects(:find).with(:all, {}) User.entries - hash = { :conditions => "users.`age` = 21" } + hash = { :conditions => "users.age = 21" } User.expects(:find).with(:all, hash).returns([]) User.select { |m| m.age == 21 }.entries end specify "to_a" do