Sha256: 6ea78fe50de8f16c572a2b0fe4dab7c3c053d255da497b354201fd34f57218f4

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

require 'test_helper'

class RelationLastTest < ActiveSupport::TestCase

  setup do
    10.times.each { |index| Model.create name: index }
    @relation = Model.page(5).per(2)
  end

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

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

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

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

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

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pageable-2.1.0 test/last_test.rb