require File.join(File.dirname(__FILE__), '..', 'og', 'CONFIG.rb') require 'test/unit' require 'nitro/helper/pager' class TC_OgPaginate < 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 class Person attr_accessor :name, String def initialize(name) @name = "Name #{name}" end end $og1.manage_classes(Person) def test_all (1..5).each do |i| Person.create(i) end items, pager = paginate(Person, :per_page => 2) assert_equal 5, pager.total_count assert_equal 2, items.size end end