Sha256: c3cdf448b4b1279e9b237f74b2c25a5acb763ee3b49fc1266e066484147f9546

Contents?: true

Size: 895 Bytes

Versions: 1

Compression:

Stored size: 895 Bytes

Contents

require "test_helper"

class ConfigurationTest < Minitest::Test
  test "sets default configuration" do
    assert_equal :page, Paginate.configuration.param_name
    assert_equal Paginate::Renderer::List, Paginate.configuration.renderer
    assert_equal 10, Paginate.configuration.size
  end

  test "yields configuration class" do
    Paginate.configure do |config|
      config.param_name = :p
      config.size  = 50
    end

    assert_equal :p, Paginate.configuration.param_name
    assert_equal 50, Paginate.configuration.size
  end

  test "returns configuration as hash" do
    Paginate.configure do |config|
      config.param_name = :p
      config.size = 25
      config.renderer = Paginate::Renderer::List
    end

    options = {
      param_name: :p,
      size: 25,
      renderer: Paginate::Renderer::List
    }

    assert_equal options, Paginate.configuration.to_hash
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paginate-4.0.1 test/paginate/configuration_test.rb