Sha256: 938c48684765e1b1eabe84f9e2d62cb6462ddeb3da0ba6608afb18f12bcc36fa

Contents?: true

Size: 737 Bytes

Versions: 5

Compression:

Stored size: 737 Bytes

Contents

require 'minitest_helper'

describe Paginator do

  array = (1..50).to_a

  it 'Defaults' do
    paginator = Paginator.new array

    paginator.page.must_equal 1
    paginator.size.must_equal 10
    
    paginator.total.must_equal 50
    paginator.pages.must_equal 5
    
    paginator.must_be :first?
    paginator.wont_be :last?

    paginator.to_a.must_equal_contents (1..10).to_a
  end

  it 'With arguments' do
    paginator = Paginator.new array, page: 3, size: 20

    paginator.page.must_equal 3
    paginator.size.must_equal 20
    
    paginator.total.must_equal 50
    paginator.pages.must_equal 3
    
    paginator.wont_be :first?
    paginator.must_be :last?

    paginator.to_a.must_equal_contents (41..50).to_a
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
core_extended-0.0.10 spec/paginator_spec.rb
core_extended-0.0.9 spec/paginator_spec.rb
core_extended-0.0.8 spec/paginator_spec.rb
core_extended-0.0.7 spec/paginator_spec.rb
core_extended-0.0.6 spec/paginator_spec.rb