Mercurial > hg > soundsoftware-site
comparison lib/plugins/classic_pagination/test/pagination_helper_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | vendor/plugins/classic_pagination/test/pagination_helper_test.rb@513646585e45 |
children |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 require File.dirname(__FILE__) + '/helper' | |
2 require File.dirname(__FILE__) + '/../init' | |
3 | |
4 class PaginationHelperTest < Test::Unit::TestCase | |
5 include ActionController::Pagination | |
6 include ActionView::Helpers::PaginationHelper | |
7 include ActionView::Helpers::UrlHelper | |
8 include ActionView::Helpers::TagHelper | |
9 | |
10 def setup | |
11 @controller = Class.new do | |
12 attr_accessor :url, :request | |
13 def url_for(options, *parameters_for_method_reference) | |
14 url | |
15 end | |
16 end | |
17 @controller = @controller.new | |
18 @controller.url = "http://www.example.com" | |
19 end | |
20 | |
21 def test_pagination_links | |
22 total, per_page, page = 30, 10, 1 | |
23 output = pagination_links Paginator.new(@controller, total, per_page, page) | |
24 assert_equal "1 <a href=\"http://www.example.com\">2</a> <a href=\"http://www.example.com\">3</a> ", output | |
25 end | |
26 | |
27 def test_pagination_links_with_prefix | |
28 total, per_page, page = 30, 10, 1 | |
29 output = pagination_links Paginator.new(@controller, total, per_page, page), :prefix => 'Newer ' | |
30 assert_equal "Newer 1 <a href=\"http://www.example.com\">2</a> <a href=\"http://www.example.com\">3</a> ", output | |
31 end | |
32 | |
33 def test_pagination_links_with_suffix | |
34 total, per_page, page = 30, 10, 1 | |
35 output = pagination_links Paginator.new(@controller, total, per_page, page), :suffix => 'Older' | |
36 assert_equal "1 <a href=\"http://www.example.com\">2</a> <a href=\"http://www.example.com\">3</a> Older", output | |
37 end | |
38 end |