Sha256: 0a7f5db8328ec91c25da2f04fe4e6dfb5f96aa60a70a64593cb8aec12033c339

Contents?: true

Size: 877 Bytes

Versions: 16

Compression:

Stored size: 877 Bytes

Contents

require 'spec_helper'

describe Mongo::Operation::KillCursors do

  let(:spec) do
    { coll_name: TEST_COLL,
      db_name: TEST_DB,
      :cursor_ids => [1,2]
    }
  end
  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 '#message' do

    it 'creates a kill cursors wire protocol message with correct specs' do
      expect(Mongo::Protocol::KillCursors).to receive(:new).with(TEST_COLL, TEST_DB, spec[:cursor_ids])
      op.send(:message, authorized_primary)
    end
  end
end

Version data entries

16 entries across 14 versions & 2 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/mongo-2.5.1/spec/mongo/operation/kill_cursors_spec.rb
mongo-2.5.1 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.5.0 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.5.0.beta spec/mongo/operation/kill_cursors_spec.rb
mongo-2.4.3 spec/mongo/operation/kill_cursors_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/kill_cursors_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/kill_cursors_spec.rb
tdiary-5.0.5 vendor/bundle/gems/mongo-2.4.2/spec/mongo/operation/kill_cursors_spec.rb
mongo-2.4.2 spec/mongo/operation/kill_cursors_spec.rb
tdiary-5.0.4 vendor/bundle/gems/mongo-2.4.1/spec/mongo/operation/kill_cursors_spec.rb
mongo-2.4.1 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.4.0 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.3.1 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.4.0.rc1 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.4.0.rc0 spec/mongo/operation/kill_cursors_spec.rb
mongo-2.3.0 spec/mongo/operation/kill_cursors_spec.rb