Sha256: e2dba34c18127c6f3b2581be01dbbcf4bd6309c814321ac385732b71634bb4f1

Contents?: true

Size: 916 Bytes

Versions: 5

Compression:

Stored size: 916 Bytes

Contents

require 'spec_helper'

module ActiveAdmin
  describe Resource, "Pagination" do

    before { load_defaults! }

    let(:application){ ActiveAdmin::Application.new }
    let(:namespace){ Namespace.new(application, :admin) }

    def config(options = {})
      @config ||= Resource.new(namespace, Category, options)
    end

    describe "#paginate" do
      it "should default to true" do
        expect(config.paginate).to eq true
      end

      it "should be settable to false" do
        config.paginate = false
        expect(config.paginate).to eq false
      end
    end

    describe "#per_page" do
      it "should default to namespace.default_per_page" do
        expect(namespace).to receive(:default_per_page).and_return(5)
        expect(config.per_page).to eq 5
      end

      it "should be settable" do
        config.per_page = 5
        expect(config.per_page).to eq 5
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
active_administration-0.0.3 spec/unit/resource/pagination_spec.rb
activeadministration-0.0.2 spec/unit/resource/pagination_spec.rb
active_administration-0.0.2 spec/unit/resource/pagination_spec.rb
activeadministration-0.0.1 spec/unit/resource/pagination_spec.rb
active_administration-0.0.1 spec/unit/resource/pagination_spec.rb