Sha256: 0f6fdd10f188c982ab5268f8ede8742c36170f433943de0c47c6e5b0c13c715b

Contents?: true

Size: 697 Bytes

Versions: 6

Compression:

Stored size: 697 Bytes

Contents

require 'spec_helper'

describe Mongo::Operation::Indexes do

  describe '#execute' do

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

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

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

    let(:operation) do
      described_class.new({ selector: { listIndexes: TEST_COLL },
                            coll_name: TEST_COLL,
                            db_name: TEST_DB })
    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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongo-2.6.4 spec/mongo/operation/indexes_spec.rb
mongo-2.6.2 spec/mongo/operation/indexes_spec.rb
mongo-2.6.1 spec/mongo/operation/indexes_spec.rb
mongo-2.6.0 spec/mongo/operation/indexes_spec.rb
mongo-2.5.3 spec/mongo/operation/indexes_spec.rb
mongo-2.5.2 spec/mongo/operation/indexes_spec.rb