Sha256: 5757504311dd25438b84a947aa37c40246dc67d67a2aecf02f7c745ea7f95606

Contents?: true

Size: 996 Bytes

Versions: 25

Compression:

Stored size: 996 Bytes

Contents

shared_context 'shared cursor' do

  let(:client) do
    double('client').tap do |client|
      allow(client).to receive(:mongos?).and_return(false)
      allow(client).to receive(:execute).and_return(*get_mores)
    end
  end

  let(:db) { Mongo::Database.new(client, TEST_DB) }
  let(:collection) do
    db[TEST_COLL].tap do |collection|
      allow(collection).to receive(:full_namespace) do
        "#{db.name}.#{collection.name}"
      end
      allow(collection).to receive(:client) { client }
    end
  end

  let(:view_options) { {} }
  let(:view) { Mongo::View::Collection.new(collection, {}, view_options) }

  let(:nonzero) { 1 }
  let(:b) { proc { |d| d } }

  let(:response) { make_response(1, 3) }

  def make_response(cursor_id = 0, nreturned = 5)
    double('response').tap do |response|
      allow(response).to receive(:documents) { (0...nreturned).to_a }
      allow(response).to receive(:cursor_id) { cursor_id }
    end
  end

  def get_mores
    [ make_response ]
  end
end

Version data entries

25 entries across 24 versions & 3 rubygems

Version Path
mongo-2.2.6 spec/support/shared/cursor.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mongo-2.2.5/spec/support/shared/cursor.rb
mongo-2.2.5 spec/support/shared/cursor.rb
mongo-2.2.4 spec/support/shared/cursor.rb
mongo-2.2.3 spec/support/shared/cursor.rb
mongo-2.2.2 spec/support/shared/cursor.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/mongo-2.2.1/spec/support/shared/cursor.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mongo-2.2.1/spec/support/shared/cursor.rb
mongo-2.2.1 spec/support/shared/cursor.rb
mongo-2.2.0 spec/support/shared/cursor.rb
mongo-2.2.0.rc0 spec/support/shared/cursor.rb
mongo-2.1.2 spec/support/shared/cursor.rb
mongo-2.1.1 spec/support/shared/cursor.rb
mongo-2.1.0 spec/support/shared/cursor.rb
mongo-2.1.0.rc0 spec/support/shared/cursor.rb
mongo-2.1.0.beta spec/support/shared/cursor.rb
mongo-2.0.6 spec/support/shared/cursor.rb
mongo-2.0.5 spec/support/shared/cursor.rb
mongo-2.0.4 spec/support/shared/cursor.rb
mongo-2.0.3 spec/support/shared/cursor.rb