Sha256: d1c42e49fb3fded94387468f2aa665634bfb280293d499635abd8804d7d20e00

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

# :nodoc: all

require "test/unit"

require "n/logger"; $log = Logger.new(STDERR) unless $log

require "n/og"
require "n/ui/pager"

class RequestMock < Hash
	def get(k, default)
		return self[k] || default
	end
end

class TC_N_UI_Pager < Test::Unit::TestCase

	def setup
=begin
		$og = N::Og.new(
			:addres => "localhost",
			:database => "testdb",
			:user => "root",
		#	:password => "navelrulez",
			:connection_count => 2
		)	
=end
	end

	def teardown
#		$og.shutdown()
	end

	def test_all
		items = [1, 2, 3, 4, 5, 6, 7, 8, 9]
		count = items.size()
		
		request = RequestMock.new()
		pager = N::UI::Pager.new("tst", request, 2, items)
		
		assert_equal(pager.total_count, count)
		
		# bug: bad rounding.
		
		assert_equal(5, pager.page_count)
		
		# bug: FIXME
		# assert_equal(2, items.size())
		
	end
	
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.3.0 test/n/ui/tc_pager.rb