Class: PaginationTest
- Inherits:
-
ActiveRecordTestCase
- Object
- Test::Unit::TestCase
- ActiveRecordTestCase
- PaginationTest
- Defined in:
- vendor/plugins/classic_pagination/test/pagination_test.rb
Defined Under Namespace
Classes: PaginationController
Instance Method Summary
- - (Object) setup
- - (Object) test_paginate_with_class_name
- - (Object) test_paginate_with_conditions
- - (Object) test_paginate_with_include_and_order
- - (Object) test_paginate_with_join_and_conditions
- - (Object) test_paginate_with_join_and_count
- - (Object) test_paginate_with_join_and_group
- - (Object) test_paginate_with_joins
- - (Object) test_paginate_with_order
- - (Object) test_paginate_with_order_by
- - (Object) test_paginate_with_per_page
-
- (Object) test_simple_paginate
Single Action Pagination Tests.
Methods inherited from ActiveRecordTestCase
Instance Method Details
- (Object) setup
89 90 91 92 93 94 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 89 def setup @controller = PaginationController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new super end |
- (Object) test_paginate_with_class_name
134 135 136 137 138 139 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 134 def test_paginate_with_class_name get :paginate_with_class_name assert assigns(:developers).size > 0 assert_equal DeVeLoPeR, assigns(:developers).first.class end |
- (Object) test_paginate_with_conditions
127 128 129 130 131 132 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 127 def test_paginate_with_conditions get :paginate_with_conditions expected = [topics(:rails)] assert_equal expected, assigns(:topics) assert_equal 1, assigns(:topic_pages).page_count end |
- (Object) test_paginate_with_include_and_order
163 164 165 166 167 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 163 def test_paginate_with_include_and_order get :paginate_with_include_and_order expected = Topic.find(:all, :include => 'replies', :order => 'replies.created_at asc, topics.created_at asc', :limit => 10) assert_equal expected, assigns(:topics) end |
- (Object) test_paginate_with_join_and_conditions
149 150 151 152 153 154 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 149 def test_paginate_with_join_and_conditions get :paginate_with_joins expected = assigns(:developers) get :paginate_with_join assert_equal expected, assigns(:developers) end |
- (Object) test_paginate_with_join_and_count
156 157 158 159 160 161 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 156 def test_paginate_with_join_and_count get :paginate_with_joins expected = assigns(:developers) get :paginate_with_join_and_count assert_equal expected, assigns(:developers) end |
- (Object) test_paginate_with_join_and_group
169 170 171 172 173 174 175 176 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 169 def test_paginate_with_join_and_group get :paginate_with_join_and_group assert_equal 2, assigns(:developers).size assert_equal 2, assigns(:developer_pages).item_count developer_names = assigns(:developers).map { |d| d.name } assert developer_names.include?('David') assert developer_names.include?('Jamis') end |
- (Object) test_paginate_with_joins
141 142 143 144 145 146 147 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 141 def test_paginate_with_joins get :paginate_with_joins assert_equal 2, assigns(:developers).size developer_names = assigns(:developers).map { |d| d.name } assert developer_names.include?('David') assert developer_names.include?('Jamis') end |
- (Object) test_paginate_with_order
110 111 112 113 114 115 116 117 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 110 def test_paginate_with_order get :paginate_with_order expected = [topics(:futurama), topics(:harvey_birdman), topics(:rails)] assert_equal expected, assigns(:topics) assert_equal 1, assigns(:topic_pages).page_count end |
- (Object) test_paginate_with_order_by
119 120 121 122 123 124 125 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 119 def test_paginate_with_order_by get :paginate_with_order expected = assigns(:topics) get :paginate_with_order_by assert_equal expected, assigns(:topics) assert_equal 1, assigns(:topic_pages).page_count end |
- (Object) test_paginate_with_per_page
104 105 106 107 108 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 104 def test_paginate_with_per_page get :paginate_with_per_page assert_equal 1, assigns(:topics).size assert_equal 3, assigns(:topic_pages).page_count end |
- (Object) test_simple_paginate
Single Action Pagination Tests
98 99 100 101 102 |
# File 'vendor/plugins/classic_pagination/test/pagination_test.rb', line 98 def test_simple_paginate get :simple_paginate assert_equal 1, assigns(:topic_pages).page_count assert_equal 3, assigns(:topics).size end |