Sha256: ab42e5a733f96dd6ba4662e587c8e2fbdd60f7904ab3ff0dc437a20b4a9787f6

Contents?: true

Size: 623 Bytes

Versions: 5

Compression:

Stored size: 623 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'CONFIG.rb')

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 & 2 rubygems

Version Path
nitro-0.41.0 test/nitro/helper/tc_pager.rb
nitro-0.30.0 test/nitro/helper/tc_pager.rb
nitro-0.31.0 test/nitro/helper/tc_pager.rb
nitro-0.40.0 test/nitro/helper/tc_pager.rb
raw-0.49.0 test/nitro/helper/tc_pager.rb