aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-06-11 00:51:11 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-06-11 00:51:11 +0000
commit43c6d7ee955e1dd55d76c49f5d93f2fcc4540670 (patch)
tree9d951d925a360c6ae5b485c12adb45bcd1ab6ea7 /actionpack/test
parent4e23e6596418a830d56c3750341e3eebcac7c9ef (diff)
downloadrails-43c6d7ee955e1dd55d76c49f5d93f2fcc4540670.tar.gz
rails-43c6d7ee955e1dd55d76c49f5d93f2fcc4540670.tar.bz2
rails-43c6d7ee955e1dd55d76c49f5d93f2fcc4540670.zip
Deprecation: remove pagination. Install the classic_pagination plugin for forward compatibility, or move to the superior will_paginate plugin. Closes #8157.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6992 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/activerecord/pagination_test.rb156
1 files changed, 0 insertions, 156 deletions
diff --git a/actionpack/test/activerecord/pagination_test.rb b/actionpack/test/activerecord/pagination_test.rb
deleted file mode 100644
index 49f153e26e..0000000000
--- a/actionpack/test/activerecord/pagination_test.rb
+++ /dev/null
@@ -1,156 +0,0 @@
-require File.dirname(__FILE__) + '/../active_record_unit'
-
-class PaginationTest < ActiveRecordTestCase
- fixtures :topics, :replies, :developers, :projects, :developers_projects
-
- class PaginationController < ActionController::Base
- self.view_paths = [ "#{File.dirname(__FILE__)}/../fixtures/" ]
-
- def simple_paginate
- @topic_pages, @topics = paginate(:topics)
- render :nothing => true
- end
-
- def paginate_with_per_page
- @topic_pages, @topics = paginate(:topics, :per_page => 1)
- render :nothing => true
- end
-
- def paginate_with_order
- @topic_pages, @topics = paginate(:topics, :order => 'created_at asc')
- render :nothing => true
- end
-
- def paginate_with_order_by
- @topic_pages, @topics = paginate(:topics, :order_by => 'created_at asc')
- render :nothing => true
- end
-
- def paginate_with_include_and_order
- @topic_pages, @topics = paginate(:topics, :include => :replies, :order => 'replies.created_at asc, topics.created_at asc')
- render :nothing => true
- end
-
- def paginate_with_conditions
- @topic_pages, @topics = paginate(:topics, :conditions => ["created_at > ?", 30.minutes.ago])
- render :nothing => true
- end
-
- def paginate_with_class_name
- @developer_pages, @developers = paginate(:developers, :class_name => "DeVeLoPeR")
- render :nothing => true
- end
-
- def paginate_with_singular_name
- @developer_pages, @developers = paginate()
- render :nothing => true
- end
-
- def paginate_with_joins
- @developer_pages, @developers = paginate(:developers,
- :joins => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id',
- :conditions => 'project_id=1')
- render :nothing => true
- end
-
- def paginate_with_join
- @developer_pages, @developers = paginate(:developers,
- :join => 'LEFT JOIN developers_projects ON developers.id = developers_projects.developer_id',
- :conditions => 'project_id=1')
- render :nothing => true
- end
-
- def paginate_with_join_and_count
- @developer_pages, @developers = paginate(:developers,
- :join => 'd LEFT JOIN developers_projects ON d.id = developers_projects.developer_id',
- :conditions => 'project_id=1',
- :count => "d.id")
- render :nothing => true
- end
-
- def rescue_errors(e) raise e end
-
- def rescue_action(e) raise end
-
- end
-
- def setup
- @controller = PaginationController.new
- @request = ActionController::TestRequest.new
- @response = ActionController::TestResponse.new
- super
- end
-
- # Single Action Pagination Tests
-
- def test_simple_paginate
- get :simple_paginate
- assert_equal 1, assigns(:topic_pages).page_count
- assert_equal 3, assigns(:topics).size
- end
-
- 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
-
- 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
-
- 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
-
- 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
-
- def test_paginate_with_class_name
- get :paginate_with_class_name
-
- assert assigns(:developers).size > 0
- assert_equal DeVeLoPeR, assigns(:developers).first.class
- end
-
- 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
-
- def test_paginate_with_join_and_conditions
- get :paginate_with_joins
- expected = assigns(:developers)
- get :paginate_with_join
- assert_equal expected, assigns(:developers)
- end
-
- 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
-
- 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
-end