Sha256: 7028cfbc3872594be6a0d5e07c41f4d85ba9face47ff5dd2122c995cf72984a2

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

require "spec_helper"

describe Paginate::Configuration do
  context "sets default configuration" do
    it { expect(Paginate.configuration.param_name).to eql(:page) }
    it { expect(Paginate.configuration.renderer).to eql(Paginate::Renderer::List) }
    it { expect(Paginate.configuration.size).to eql(10) }
  end

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

    expect(Paginate.configuration.param_name).to eql(:p)
    expect(Paginate.configuration.size).to eql(50)
  end

  it "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
    }

    expect(Paginate.configuration.to_hash).to eql(options)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paginate-4.0.0 spec/paginate/configuration_spec.rb