Sha256: 85b8f1c15831c8d6bf2f184407c3a2e17bab1e7275d620536304428cd5297636

Contents?: true

Size: 964 Bytes

Versions: 24

Compression:

Stored size: 964 Bytes

Contents

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

class TestPagination < Test::Unit::TestCase
  fixtures :reference_types, :reference_codes
  
  include ActionController::Pagination
  DEFAULT_PAGE_SIZE = 2
  
  attr_accessor :params
   
  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
    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

24 entries across 24 versions & 3 rubygems

Version Path
mingusbabcock-composite_primary_keys-2.2.2.1 test/test_pagination.rb
tyler-composite_primary_keys-1.1.0 test/test_pagination.rb
tyler-composite_primary_keys-1.1.1 test/test_pagination.rb
tyler-composite_primary_keys-1.1.2 test/test_pagination.rb
tyler-composite_primary_keys-1.1.3 test/test_pagination.rb
tyler-composite_primary_keys-1.1.4 test/test_pagination.rb
composite_primary_keys-1.0.1 test/test_pagination.rb
composite_primary_keys-1.0.10 test/test_pagination.rb
composite_primary_keys-1.0.3 test/test_pagination.rb
composite_primary_keys-0.9.90 test/test_pagination.rb
composite_primary_keys-1.0.0 test/test_pagination.rb
composite_primary_keys-1.0.2 test/test_pagination.rb
composite_primary_keys-0.9.91 test/test_pagination.rb
composite_primary_keys-0.9.92 test/test_pagination.rb
composite_primary_keys-0.9.93 test/test_pagination.rb
composite_primary_keys-1.1.0 test/test_pagination.rb
composite_primary_keys-2.2.0 test/test_pagination.rb
composite_primary_keys-2.2.1 test/test_pagination.rb
composite_primary_keys-1.0.8 test/test_pagination.rb
composite_primary_keys-1.0.5 test/test_pagination.rb