Sha256: 377373eff14577beebbbdd92dea04c3e798789450c4a547f656026f9f1d4778d

Contents?: true

Size: 806 Bytes

Versions: 8

Compression:

Stored size: 806 Bytes

Contents

require 'test_helper'
require 'geared_pagination/ratios'

class GearedPagination::RatiosTest < ActiveSupport::TestCase
  test "single limit" do
    limits = GearedPagination::Ratios.new(10)

    assert_equal 10, limits[1]
    assert_equal 10, limits[2]
  end

  test "range of limits" do
    limits = GearedPagination::Ratios.new([ 10, 25, 100 ])

    assert_equal 10, limits[1]
    assert_equal 25, limits[2]
    assert_equal 100, limits[3]
    assert_equal 100, limits[4]
  end

  test "default limits" do
    limits = GearedPagination::Ratios.new

    assert_equal GearedPagination::Ratios::DEFAULTS.first, limits[1]
    assert_equal GearedPagination::Ratios::DEFAULTS.last, limits[99]
  end

  test "cache key" do
    assert_equal "1-2-3", GearedPagination::Ratios.new([ 1, 2, 3 ]).cache_key
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
geared_pagination-1.2.0 test/ratios_test.rb
geared_pagination-1.1.2 test/ratios_test.rb
geared_pagination-1.1.1 test/ratios_test.rb
geared_pagination-1.1.0 test/ratios_test.rb
geared_pagination-1.0.2 test/ratios_test.rb
geared_pagination-1.0.1 test/ratios_test.rb
geared_pagination-1.0.0 test/ratios_test.rb
geared_pagination-0.2 test/ratios_test.rb