Sha256: 3b2f8b856aeeb60328c9d9a23101013207d2dcaa66856ed9cdbf68e2420dae16

Contents?: true

Size: 862 Bytes

Versions: 18

Compression:

Stored size: 862 Bytes

Contents

require 'abstract_unit'
require 'plugins/pagination'

class TestPagination < ActiveSupport::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

18 entries across 18 versions & 1 rubygems

Version Path
composite_primary_keys-3.1.11 test/test_pagination.rb
composite_primary_keys-4.0.0.beta7 test/test_pagination.rb
composite_primary_keys-4.0.0.beta6 test/test_pagination.rb
composite_primary_keys-4.0.0.beta5 test/test_pagination.rb
composite_primary_keys-4.0.0.beta4 test/test_pagination.rb
composite_primary_keys-4.0.0.beta3 test/test_pagination.rb
composite_primary_keys-3.1.10 test/test_pagination.rb
composite_primary_keys-4.0.0.beta2 test/test_pagination.rb
composite_primary_keys-4.0.0.beta1 test/test_pagination.rb
composite_primary_keys-3.1.9 test/test_pagination.rb
composite_primary_keys-3.1.8 test/test_pagination.rb
composite_primary_keys-3.1.7 test/test_pagination.rb
composite_primary_keys-3.1.6 test/test_pagination.rb
composite_primary_keys-3.1.5 test/test_pagination.rb
composite_primary_keys-3.1.4 test/test_pagination.rb
composite_primary_keys-3.1.2 test/test_pagination.rb
composite_primary_keys-3.1.1 test/test_pagination.rb
composite_primary_keys-3.1.0 test/test_pagination.rb