1 require File.dirname(__FILE__) + '/helper'
 
   2 require File.dirname(__FILE__) + '/../init'
 
   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
 
  11     @controller = Class.new do
 
  12       attr_accessor :url, :request
 
  13       def url_for(options, *parameters_for_method_reference)
 
  17     @controller = @controller.new
 
  18     @controller.url = "http://www.example.com"
 
  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
 
  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
 
  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