Sha256: cae0b0f042a761841a8296fd756c95b06b34927882e2625f40cdd4091f3db2f5

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Mongo::Operation::KillCursors do
  include_context 'operation'

  let(:spec) { { :cursor_ids => [1,2] } }
  let(:op) { described_class.new(spec) }

  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
        { :cursor_ids => [1, 2, 3] }
      end
      let(:other) { described_class.new(other_spec) }

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

  describe '#execute' do

    context 'message' do

      it 'creates a kill cursors wire protocol message with correct specs' do
        expect(Mongo::Protocol::KillCursors).to receive(:new) do |collection, database, ids|
          expect(ids).to eq(spec[:cursor_ids])
        end
        op.execute(primary_context)
      end
    end

    context 'connection' do

      it 'dispatches the message on the connection' do
        expect(connection).to receive(:dispatch)
        op.execute(primary_context)
      end
    end
  end
end

Version data entries

15 entries across 14 versions & 3 rubygems

Version Path
mongo-2.2.7 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.2.6 spec/mongo/operation/kill_cursors_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mongo-2.2.5/spec/mongo/operation/kill_cursors_spec.rb
mongo-2.2.5 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.2.4 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.2.3 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.2.2 spec/mongo/operation/kill_cursors_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/mongo-2.2.1/spec/mongo/operation/kill_cursors_spec.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mongo-2.2.1/spec/mongo/operation/kill_cursors_spec.rb
mongo-2.2.1 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.2.0 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.2.0.rc0 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.1.2 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.1.1 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.1.0 spec/mongo/operation/kill_cursors_spec.rb