File: op_get_more_spec.rb

package info (click to toggle)
ruby-mongo 2.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,332 kB
  • sloc: ruby: 45,579; makefile: 5
file content (52 lines) | stat: -rw-r--r-- 1,023 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'spec_helper'

describe Mongo::Cursor::Builder::OpGetMore do

  describe '#specification' do

    let(:reply) do
      Mongo::Protocol::Reply.allocate
    end

    let(:result) do
      Mongo::Operation::Result.new(reply)
    end

    let(:view) do
      Mongo::Collection::View.new(
        authorized_collection,
        {},
        tailable: true,
        max_time_ms: 100
      )
    end

    let(:cursor) do
      Mongo::Cursor.new(view, result, authorized_primary)
    end

    let(:builder) do
      described_class.new(cursor)
    end

    let(:specification) do
      builder.specification
    end

    it 'includes to return' do
      expect(specification[:to_return]).to eq(0)
    end

    it 'includes the cursor id' do
      expect(specification[:cursor_id]).to eq(cursor.id)
    end

    it 'includes the database name' do
      expect(specification[:db_name]).to eq(TEST_DB)
    end

    it 'includes the collection name' do
      expect(specification[:coll_name]).to eq(TEST_COLL)
    end
  end
end