Sha256: 63c9a736395757f1becb1ff618cfff88a1ebe1294f4602f3b4e26c91710b6525

Contents?: true

Size: 711 Bytes

Versions: 5

Compression:

Stored size: 711 Bytes

Contents

require 'test_helper'

class MiddleTest < ActiveSupport::TestCase

  setup do
    10.times.each { |index| Record.create }
  end

  test 'total pages' do
    assert_equal 5, relation.total_pages
  end

  test 'current page' do
    assert_equal 3, relation.current_page
  end

  test 'first page' do
    assert_equal 1, relation.first_page
  end

  test 'previous page' do
    assert_equal 2, relation.previous_page
  end

  test 'next page' do
    assert_equal 4, relation.next_page
  end
  
  test 'last page' do
    assert_equal 5, relation.last_page
  end

  test 'out of bounds' do
    assert !relation.out_of_bounds?
  end

  protected

  def relation
    @relation ||= Record.page(3, length: 2)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pagers-3.1.5 test/middle_test.rb
pagers-3.1.4 test/middle_test.rb
pagers-3.1.3 test/middle_test.rb
pagers-3.1.2 test/middle_test.rb
pagers-3.1.1 test/middle_test.rb