Sha256: c4f5cbb7f7c3f11af94d1149c5ba88a3571e37cf41398416598a728a656b128c

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

require 'test_helper'

class MiddleTest < ActiveSupport::TestCase

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

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

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

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

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

  test 'should have next page 4' do
    assert_equal 4, relation.next_page
  end
  
  test 'last page shuold be 5' do
    assert_equal 5, relation.last_page
  end

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

  protected

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pagers-3.1.0 test/middle_test.rb