File: indexes_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 (31 lines) | stat: -rw-r--r-- 597 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
require 'spec_helper'

describe Mongo::Operation::Commands::Indexes do

  describe '#execute' do

    let(:spec) do
      { name: 1 }
    end

    before do
      authorized_collection.indexes.create_one(spec, unique: true)
    end

    after do
      authorized_collection.indexes.drop_one('name_1')
    end

    let(:operation) do
      described_class.new(db_name: TEST_DB, coll_name: TEST_COLL)
    end

    let(:indexes) do
      operation.execute(authorized_primary)
    end

    it 'returns the indexes for the collection' do
      expect(indexes.documents.size).to eq(2)
    end
  end
end