Sha256: 25e93a89996a324ec670cdc7e5e97a29eda9e062a78aa45464bcb17e04ca4c67

Contents?: true

Size: 652 Bytes

Versions: 1

Compression:

Stored size: 652 Bytes

Contents

require "spec_helper"

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

  it { expect(Thing).to respond_to(:paginate) }

  it "uses default options" do
    items = Thing.limit(11).to_a
    expect(Thing.paginate.to_a).to eql(items)

    items = Thing.limit(11).offset(10).to_a
    expect(Thing.paginate(page: 2).to_a).to eql(items)
  end

  it "uses custom options" do
    items = Thing.limit(6).to_a
    expect(Thing.paginate(size: 5).to_a).to eql(items)

    items = Thing.limit(6).offset(5).to_a
    expect(Thing.paginate(size: 5, page: 2).to_a).to eql(items)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paginate-3.0.0 spec/paginate/activerecord_spec.rb