Sha256: 6d625bca6bc01d9c44800b1a670c9135ccb735beef758f258bd4504ed8cc1561

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

require 'test_helper'

class CollectionLastTest < ActiveSupport::TestCase

  setup do
    10.times.each { |id| Model.create title: "Record #{id}" }
    @collection = Model.page(5).per(2)
  end

  test "should have 5 pages" do
    assert_equal @collection.total_pages, 5
  end

  test "current page should be 5" do
    assert_equal @collection.current_page, 5
  end

  test "first page should be 1" do
    assert_equal @collection.first_page, 1
  end

  test "should have previous page 4" do
    assert_equal @collection.previous_page, 4
  end

  test "should not have next page" do
    assert_nil @collection.next_page
  end
  
  test "last page shuold be 5" do
    assert_equal @collection.last_page, 5
  end

  test "should not be out of bounds" do
    assert !@collection.out_of_bounds?
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_pagination-2.0.10 test/collection_last_test.rb
rails_pagination-2.0.9 test/collection_last_test.rb
rails_pagination-2.0.8 test/collection_last_test.rb
rails_pagination-2.0.7 test/collection_last_test.rb