Sha256: 19829e4ac6640c5d19fc1feef5f1c997160009e84121fa06d575618ec9280b83

Contents?: true

Size: 812 Bytes

Versions: 11

Compression:

Stored size: 812 Bytes

Contents

require 'spec_helper'

if defined? ActiveRecord

  describe 'default per_page' do
    describe 'AR::Base' do
      subject { ActiveRecord::Base }
      it { should_not respond_to :paginates_per }
    end

    subject { User.page 0 }

    context 'by default' do
      its(:limit_value) { should == 25 }
    end

    context 'when explicitly set via paginates_per' do
      before { User.paginates_per 1326 }
      its(:limit_value) { should == 1326 }
      after { User.paginates_per nil }
    end

    describe "default per_page value's independency per model" do
      context "when User's default per_page was changed" do
        before { User.paginates_per 1326 }
        subject { Book.page 0 }
        its(:limit_value) { should == 25 }
        after { User.paginates_per nil }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
bootstrap_pager-0.11.0 spec/models/active_record/default_per_page_spec.rb
bootstrap_pager-0.10.1 spec/models/active_record/default_per_page_spec.rb
bootstrap_pager-0.10.0 spec/models/active_record/default_per_page_spec.rb
bootstrap_pager-0.9.3 spec/models/active_record/default_per_page_spec.rb
bootstrap_pager-0.9.2 spec/models/active_record/default_per_page_spec.rb
bootstrap_pager-0.9.1 spec/models/active_record/default_per_page_spec.rb
bootstrap_pager-0.9.0 spec/models/active_record/default_per_page_spec.rb
kaminari-rails4-0.15.0 spec/models/active_record/default_per_page_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/kaminari-0.14.1/spec/models/active_record/default_per_page_spec.rb
kaminari-0.14.1 spec/models/active_record/default_per_page_spec.rb
kaminari-0.14.0 spec/models/active_record/default_per_page_spec.rb