Sha256: 22b5220e2680889eb363cce6f58a917b03c42b6ac163e2c102dccc8e1d33a4f7

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 KB

Contents

require File.expand_path('spec_helper', File.dirname(__FILE__))

describe "CursorPaginatedCollection" do
  subject { Sunspot::Search::CursorPaginatedCollection.new [], 10, 20, '*', 'AoIIP4AAACxQcm9maWxlIDEwMTk=' }

  it { subject.should be_an(Array) }

  describe "#send" do
    it 'should allow send' do
      expect { subject.send(:current_cursor) }.to_not raise_error
    end
  end

  describe "#respond_to?" do
    it 'should return true for current_cursor' do
      subject.respond_to?(:current_cursor).should be_true
    end
  end

  context "behaves like a WillPaginate::Collection" do
    it { subject.total_entries.should eql(20) }
    it { subject.total_pages.should eql(2) }
    it { subject.current_cursor.should eql('*') }
    it { subject.per_page.should eql(10) }
    it { subject.next_page_cursor.should eql('AoIIP4AAACxQcm9maWxlIDEwMTk=') }
  end

  context "behaves like Kaminari" do
    it { subject.total_count.should eql(20) }
    it { subject.num_pages.should eql(2) }
    it { subject.limit_value.should eql(10) }
    it { subject.first_page?.should be_true }
    it { subject.last_page?.should be_true }
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sunspot-2.2.7/spec/api/search/cursor_paginated_collection_spec.rb
sunspot-2.2.7 spec/api/search/cursor_paginated_collection_spec.rb
sunspot-2.2.6 spec/api/search/cursor_paginated_collection_spec.rb
sunspot-2.2.5 spec/api/search/cursor_paginated_collection_spec.rb
sunspot-2.2.4 spec/api/search/cursor_paginated_collection_spec.rb
sunspot-2.2.3 spec/api/search/cursor_paginated_collection_spec.rb
sunspot-2.2.2 spec/api/search/cursor_paginated_collection_spec.rb
sunspot-2.2.1 spec/api/search/cursor_paginated_collection_spec.rb
sunspot-2.2.0 spec/api/search/cursor_paginated_collection_spec.rb