Sha256: ef0a289134bb5ac12cc0b3bc8ac037565d63108726cc4be874f06da17ffb415c

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

require 'test_helper'

class RelationFirstTest < ActiveSupport::TestCase

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

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

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

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

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

  test "next page should be 2" do
    assert_equal @relation.next_page, 2
  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/first_test.rb