Sha256: b2bba663d248074cbfaf83f61ce8ee55a2b2702264fe0e66965db7e803144ce4

Contents?: true

Size: 975 Bytes

Versions: 8

Compression:

Stored size: 975 Bytes

Contents

require 'spec_helper'
describe "RSolr::Pagination" do
  context "build_paginated_request" do
    it "should create the proper solr params and query string" do
      c = RSolr::Client.new(nil, {})#.extend(RSolr::Pagination::Client)
      r = c.build_paginated_request 3, 25, "select", {:params => {:q => "test"}}
      #r[:page].should == 3
      #r[:per_page].should == 25
      r[:params]["start"].should == 50
      r[:params]["rows"].should == 25
      r[:uri].query.should =~ /rows=25/
      r[:uri].query.should =~ /start=50/
    end
  end
  context "paginate" do
    it "should build a paginated request context and call execute" do
      c = RSolr::Client.new(nil, {})#.extend(RSolr::Pagination::Client)
      c.should_receive(:execute).with(hash_including({
        #:page => 1,
        #:per_page => 10,
        :params => {
          "rows" => 10,
          "start" => 0,
          :wt => :ruby
        }
      }))
      c.paginate 1, 10, "select"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rsolr-1.0.10 spec/api/pagination_spec.rb
rsolr-1.0.10.pre1 spec/api/pagination_spec.rb
rsolr-1.0.9 spec/api/pagination_spec.rb
rsolr-1.0.8 spec/api/pagination_spec.rb
rsolr-1.0.7 spec/api/pagination_spec.rb
rsolr-1.0.6 spec/api/pagination_spec.rb
rsolr-1.0.5 spec/api/pagination_spec.rb
rsolr-1.0.3 spec/api/pagination_spec.rb