Sha256: 89fbde8a380a564bbb8dc9aad9cbacd6d2acc54ad05bddafc9b9d86a1562459c

Contents?: true

Size: 1.41 KB

Versions: 12

Compression:

Stored size: 1.41 KB

Contents

require File.dirname(__FILE__) + '/helper'
require File.dirname(__FILE__) + '/../init'

class PaginationHelperTest < Test::Unit::TestCase
  include ActionController::Pagination
  include ActionView::Helpers::PaginationHelper
  include ActionView::Helpers::UrlHelper
  include ActionView::Helpers::TagHelper

  def setup
    @controller = Class.new do
      attr_accessor :url, :request
      def url_for(options, *parameters_for_method_reference)
        url
      end
    end
    @controller = @controller.new
    @controller.url = "http://www.example.com"
  end

  def test_pagination_links
    total, per_page, page = 30, 10, 1
    output = pagination_links Paginator.new(@controller, total, per_page, page)
    assert_equal "1 <a href=\"http://www.example.com\">2</a> <a href=\"http://www.example.com\">3</a> ", output
  end

  def test_pagination_links_with_prefix
    total, per_page, page = 30, 10, 1
    output = pagination_links Paginator.new(@controller, total, per_page, page), :prefix => 'Newer '
    assert_equal "Newer 1 <a href=\"http://www.example.com\">2</a> <a href=\"http://www.example.com\">3</a> ", output
  end

  def test_pagination_links_with_suffix
    total, per_page, page = 30, 10, 1
    output = pagination_links Paginator.new(@controller, total, per_page, page), :suffix => 'Older'
    assert_equal "1 <a href=\"http://www.example.com\">2</a> <a href=\"http://www.example.com\">3</a> Older", output
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
classic_pagination-1.0.4 test/pagination_helper_test.rb
classic_pagination-1.0.3 test/pagination_helper_test.rb
parlement-0.17 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.0.1 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.0.2 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.0.3.98.1 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.0 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.0.3.98 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.1.2 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.1.1 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.1.3 vendor/plugins/classic_pagination/test/pagination_helper_test.rb
typo-5.1 vendor/plugins/classic_pagination/test/pagination_helper_test.rb