Permalink
Browse files

increase specs

  • Loading branch information...
1 parent 2fc58a5 commit 1d490fde99e431bbb7ca75b06cdf94824098099c Lucas Souza committed Oct 20, 2011
Showing with 12 additions and 6 deletions.
  1. +12 −6 spec/integration/mongoid_paginator_spec.rb
View
18 spec/integration/mongoid_paginator_spec.rb
@@ -33,23 +33,29 @@ class Game
context "when called in a Mongoid::Criteria" do
before :each do
- @games = 30.times.map do |i|
+ @games = 15.times.map do |i|
Game.create :title => "title"
end
+
+ 15.times do
+ Game.create :title => "other title"
+ end
+
+ @criteria = Game.where(:title => "title")
end
context "and parameters is given" do
- subject { Game.where(:title => "title").paginate :page => 2, :per_page => 10 }
+ subject { @criteria.paginate :page => 2, :per_page => 10 }
it { should be_a_instance_of WillPaginate::Collection }
- its(:to_a) { should == @games[10..19] }
- its(:total_entries) { should == Game.count }
+ its(:to_a) { should == @games[10..14] }
+ its(:total_entries) { should == @criteria.count }
end
context "and parameters is not given" do
- subject { Game.where(:title => "title").paginate }
+ subject { @criteria.paginate }
it { should be_a_instance_of WillPaginate::Collection }
its(:to_a) { should == @games[0..9] }
- its(:total_entries) { should == 30 }
+ its(:total_entries) { should == @criteria.count }
end
end
end

0 comments on commit 1d490fd

Please sign in to comment.