Sha256: 9bc8d2398ebb6b6fcbdb4ddd1898bf674b2d1e8ffc7046b5752a3303d077c178

Contents?: true

Size: 1.31 KB

Versions: 16

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'spec_helper'

describe Mongo::Operation::GetMore::Legacy do

  let(:to_return) do
    50
  end

  let(:cursor_id) do
    1
  end

  let(:spec) do
    { :db_name   => SpecConfig.instance.test_db,
      :coll_name => TEST_COLL,
      :to_return => to_return,
      :cursor_id => cursor_id }
  end

  let(:op) { described_class.new(spec) }

  let(:context) { Mongo::Operation::Context.new }

  describe '#initialize' do

    it 'sets the spec' do
      expect(op.spec).to be(spec)
    end
  end

  describe '#==' do

    context ' when two ops have different specs' do
      let(:other_spec) do
        { :db_name   => 'test_db',
          :coll_name => 'test_coll',
          :to_return => 50,
          :cursor_id => 2 }
      end
      let(:other) { described_class.new(other_spec) }

      it 'returns false' do
        expect(op).not_to eq(other)
      end
    end
  end

  describe '#message' do

    it 'creates a get more wire protocol message with correct specs' do
      expect(Mongo::Protocol::GetMore).to receive(:new).with(SpecConfig.instance.test_db, TEST_COLL, to_return, cursor_id).and_call_original
      begin
        authorized_primary.with_connection do |connection|
          op.execute(connection, context: context)
        end
      rescue
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mongo-2.16.4 spec/mongo/operation/get_more_spec.rb
mongo-2.17.4 spec/mongo/operation/get_more_spec.rb
mongo-2.17.3 spec/mongo/operation/get_more_spec.rb
mongo-2.18.1 spec/mongo/operation/get_more_spec.rb
mongo-2.18.0 spec/mongo/operation/get_more_spec.rb
mongo-2.17.2 spec/mongo/operation/get_more_spec.rb
mongo-2.16.3 spec/mongo/operation/get_more_spec.rb
mongo-2.18.0.beta1 spec/mongo/operation/get_more_spec.rb
mongo-2.16.2 spec/mongo/operation/get_more_spec.rb
mongo-2.17.1 spec/mongo/operation/get_more_spec.rb
mongo-2.16.1 spec/mongo/operation/get_more_spec.rb
mongo-2.17.0 spec/mongo/operation/get_more_spec.rb
mongo-2.16.0 spec/mongo/operation/get_more_spec.rb
mongo-2.15.1 spec/mongo/operation/get_more_spec.rb
mongo-2.16.0.alpha1 spec/mongo/operation/get_more_spec.rb
mongo-2.15.0 spec/mongo/operation/get_more_spec.rb