spec/models/scopes_spec.rb in kaminari-0.10.4 vs spec/models/scopes_spec.rb in kaminari-0.11.0
- old
+ new
@@ -1,10 +1,9 @@
require File.expand_path('../spec_helper', File.dirname(__FILE__))
describe Kaminari::ActiveRecordExtension do
before :all do
- User.delete_all
1.upto(100) {|i| User.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
end
describe '#page' do
shared_examples_for 'the first page' do
@@ -90,9 +89,21 @@
end
context 'page 2' do
subject { User.page(2).per 3 }
its(:current_page) { should == 2 }
+ end
+ end
+
+ describe '#count' do
+ context 'page 1' do
+ subject { User.page }
+ its(:count) { should == 25 }
+ end
+
+ context 'page 2' do
+ subject { User.page 2 }
+ its(:count) { should == 25 }
end
end
context 'chained with .group' do
subject { User.group('age').page(2).per 5 }