Sha256: 5ceade661dedc7483302f4a22f14c5df95d9147f1ad7797dc603f5ec2845f2b7

Contents?: true

Size: 952 Bytes

Versions: 8

Compression:

Stored size: 952 Bytes

Contents

require 'abstract_unit'
require 'fixtures/reference_type'
require 'fixtures/reference_code'
require 'action_controller/pagination'

class PaginationTest < Test::Unit::TestCase
  fixtures :reference_types, :reference_codes
  include ActionController::Pagination
  DEFAULT_PAGE_SIZE = 2
   
  CLASSES = {
    :single => {
      :class => ReferenceType,
      :primary_keys => :reference_type_id,
      :table => :reference_types,
    },
    :dual   => { 
      :class => ReferenceCode,
      :primary_keys => [:reference_type_id, :reference_code],
      :table => :reference_codes,
    },
  }
  
  def setup
    super
    self.class.classes = CLASSES
    @params = {}
  end

  def test_paginate_all
    testing_with do
      @object_pages, @objects = paginate @klass_info[:table], :per_page => DEFAULT_PAGE_SIZE
      assert_equal 2, @objects.length, "Each page should have #{DEFAULT_PAGE_SIZE} items"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
composite_primary_keys-0.7.1 test/pagination_test.rb
composite_primary_keys-0.6.2 test/pagination_test.rb
composite_primary_keys-0.6.3 test/pagination_test.rb
composite_primary_keys-0.7.0 test/pagination_test.rb
composite_primary_keys-0.7.5 test/pagination_test.rb
composite_primary_keys-0.7.2 test/pagination_test.rb
composite_primary_keys-0.7.3 test/pagination_test.rb
composite_primary_keys-0.7.4 test/pagination_test.rb