Sha256: 97193eb206328f9c24a9b2f390d8a4c42f8edd0658e2108e13d87df490855402

Contents?: true

Size: 799 Bytes

Versions: 4

Compression:

Stored size: 799 Bytes

Contents

require 'test_helper'

class CollectionFirstTest < ActiveSupport::TestCase

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

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

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

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

  test "should have no previous page" do
    assert_nil @collection.previous_page
  end

  test "next page should be 2" do
    assert_equal @collection.next_page, 2
  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_first_test.rb
rails_pagination-2.0.9 test/collection_first_test.rb
rails_pagination-2.0.8 test/collection_first_test.rb
rails_pagination-2.0.7 test/collection_first_test.rb