Sha256: 50612bf7fc90f4f560e8afd8b7f3033031cc7e81635e8afa96af7adf5e2ac10c

Contents?: true

Size: 632 Bytes

Versions: 5

Compression:

Stored size: 632 Bytes

Contents

$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')

require 'test/unit'

require 'nitro/helper/pager'

class TC_Pager < Test::Unit::TestCase # :nodoc: all
  include Nitro
  include Nitro::PagerHelper

  class RequestMock < Hash
    attr_accessor :query
    
    def initialize
      @query = {}
    end
    
    def get(k, default)
      return self[k] || default
    end
  end
  
  def request
    RequestMock.new
  end
  
  def test_all
    stuff = [1, 2, 3, 4, 5, 6, 7, 8, 9]

    items, pager = paginate(stuff, :per_page => 2)
    assert_equal 2, items.size
    assert_equal 9, pager.total_count
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nitro-0.25.0 test/nitro/helper/tc_pager.rb
nitro-0.26.0 test/nitro/helper/tc_pager.rb
nitro-0.27.0 test/nitro/helper/tc_pager.rb
nitro-0.28.0 test/nitro/helper/tc_pager.rb
nitro-0.29.0 test/nitro/helper/tc_pager.rb