Add version 2.2.2 of composite_primary_keys.
This commit is contained in:
parent
9156448ad6
commit
a69f380fa5
147 changed files with 6140 additions and 0 deletions
38
vendor/gems/composite_primary_keys-2.2.2/test/test_pagination.rb
vendored
Normal file
38
vendor/gems/composite_primary_keys-2.2.2/test/test_pagination.rb
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue