Sha256: d5df166bb46b86120a24adf7b0fc9b2c15a79bb6154d4b321d3878646797b214

Contents?: true

Size: 1.94 KB

Versions: 15

Compression:

Stored size: 1.94 KB

Contents

require 'spec_helper'

describe Kaminari::Configuration do
  subject { Kaminari.config }
  describe 'default_per_page' do
    context 'by default' do
      its(:default_per_page) { should == 25 }
    end
    context 'configured via config block' do
      before do
        Kaminari.configure {|c| c.default_per_page = 17}
      end
      its(:default_per_page) { should == 17 }
      after do
        Kaminari.configure {|c| c.default_per_page = 25}
      end
    end
  end

  describe 'max_per_page' do
    context 'by default' do
      its(:max_per_page) { should == nil }
    end
    context 'configure via config block' do
      before do
        Kaminari.configure {|c| c.max_per_page = 100}
      end
      its(:max_per_page) { should == 100 }
      after do
        Kaminari.configure {|c| c.max_per_page = nil}
      end
    end
  end

  describe 'window' do
    context 'by default' do
      its(:window) { should == 4 }
    end
  end

  describe 'outer_window' do
    context 'by default' do
      its(:outer_window) { should == 0 }
    end
  end

  describe 'left' do
    context 'by default' do
      its(:left) { should == 0 }
    end
  end

  describe 'right' do
    context 'by default' do
      its(:right) { should == 0 }
    end
  end

  describe 'param_name' do
    context 'by default' do
      its(:param_name) { should == :page }
    end

    context 'configured via config block' do
      before do
        Kaminari.configure {|c| c.param_name = lambda { :test } }
      end

      its(:param_name) { should == :test }

      after do
        Kaminari.configure {|c| c.param_name = :page }
      end
    end
  end

  describe 'max_pages' do
    context 'by default' do
      its(:max_pages) { should == nil }
    end
    context 'configure via config block' do
      before do
        Kaminari.configure {|c| c.max_pages = 5}
      end
      its(:max_pages) { should == 5 }
      after do
        Kaminari.configure {|c| c.max_pages = nil}
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 7 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/kaminari-0.17.0/spec/config/config_spec.rb
kaminari-0.17.0 spec/config/config_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/kaminari-0.16.3/spec/config/config_spec.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/kaminari-0.16.3/spec/config/config_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/kaminari-0.16.3/spec/config/config_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/kaminari-0.16.3/spec/config/config_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/kaminari-0.16.3/spec/config/config_spec.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/kaminari-0.16.3/spec/config/config_spec.rb
kaminari-0.16.3 spec/config/config_spec.rb
kaminari-0.16.2 spec/config/config_spec.rb
kaminari-0.16.1 spec/config/config_spec.rb
kaminari-0.16.0 spec/config/config_spec.rb
kaminari-0.15.1 spec/config/config_spec.rb
kaminari-0.15.0 spec/config/config_spec.rb
kaminari-rails4-0.15.0 spec/config/config_spec.rb