Sha256: c3063e062bd8fb56902040d1d7adee937817fa0e2d3901810f7e0dc48d124d01

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
og-0.41.0 test/glue/tc_og_paginate.rb
og-0.40.0 test/glue/tc_og_paginate.rb