Sha256: cd655b6149011c38b01adaf19f3fa76934d2af69343b960d7795961f7034abf4

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 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

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.20.0 test/nitro/mixin/tc_pager.rb