Sha256: 7c522f3547f9374a6a3ccdd48b17fcc9888ae9bcc14577e44fab7aff4560f68e

Contents?: true

Size: 630 Bytes

Versions: 5

Compression:

Stored size: 630 Bytes

Contents

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

require 'test/unit'

require 'nitro/mixin/pager'

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

  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.21.0 test/nitro/mixin/tc_pager.rb
nitro-0.21.2 test/nitro/mixin/tc_pager.rb
nitro-0.22.0 test/nitro/mixin/tc_pager.rb
nitro-0.23.0 test/nitro/mixin/tc_pager.rb
nitro-0.24.0 test/nitro/mixin/tc_pager.rb