Sha256: 37729a6705dcaf946a8129240dd3e8c85a4889f82238adf411e91ee237f456d8

Contents?: true

Size: 752 Bytes

Versions: 16

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

describe Lcms::Engine::Pagination do
  describe 'params' do
    it 'has defaults' do
      pagination = described_class.new({})
      expect(pagination.params[:page]).to eq 1
      expect(pagination.params[:per_page]).to eq 20
      expect(pagination.params[:order]).to eq :asc
    end

    it 'filters invalid keys' do
      pagination = described_class.new page: 3, something: 'else'
      expect(pagination.params[:page]).to eq 3
      expect(pagination.params.keys).to eq %i(page per_page order)
    end

    it 'has a strict mode (used for search)' do
      pagination = described_class.new page: 3
      expect(pagination.params(strict: true).keys).to eq %i(page per_page)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lcms-engine-0.5.5 spec/entities/pagination_spec.rb
lcms-engine-0.5.4 spec/entities/pagination_spec.rb
lcms-engine-0.5.3 spec/entities/pagination_spec.rb
lcms-engine-0.5.2 spec/entities/pagination_spec.rb
lcms-engine-0.5.1 spec/entities/pagination_spec.rb
lcms-engine-0.5.0 spec/entities/pagination_spec.rb
lcms-engine-0.4.2 spec/entities/pagination_spec.rb
lcms-engine-0.4.1 spec/entities/pagination_spec.rb
lcms-engine-0.4.0 spec/entities/pagination_spec.rb
lcms-engine-0.3.1 spec/entities/pagination_spec.rb
lcms-engine-0.1.4 spec/entities/pagination_spec.rb
lcms-engine-0.3.0 spec/entities/pagination_spec.rb
lcms-engine-0.1.3 spec/entities/pagination_spec.rb
lcms-engine-0.2.0 spec/entities/pagination_spec.rb
lcms-engine-0.1.2 spec/entities/pagination_spec.rb
lcms-engine-0.1.0 spec/entities/pagination_spec.rb