Sha256: 2e5142c4dcae4b40945e505ce65ff3fb7560a21cc742056b00984d9d1d306e2e

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

require "spec_helper"

describe Thing do
  let!(:things) { Array.new(15) {|i| Thing.create!(:name => "Thing #{i}") } }
  before { Paginate::Config.size = 10 }

  specify { Thing.should respond_to(:paginate) }

  it "should use default options" do
    Thing.paginate.all.should == Thing.all(:limit => 11)
    Thing.paginate(:page => 2).all.should == Thing.all(:limit => 11, :offset => 10)
  end

  it "should use custom options" do
    Thing.paginate(:size => 5).should == Thing.all(:limit => 6)
    Thing.paginate(:size => 5, :page => 2).should == Thing.all(:limit => 6, :offset => 5)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paginate-1.0.1 spec/paginate/activerecord_spec.rb
paginate-1.0.0 spec/paginate/activerecord_spec.rb