Sha256: 5467d53cee7264eabbd89a26385b5aa3a42223e8d6c2d7e5ed59b20a32497dbf

Contents?: true

Size: 950 Bytes

Versions: 18

Compression:

Stored size: 950 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'spec_helper'

describe Mongo::Operation::Indexes do
  require_no_required_api_version

  let(:context) { Mongo::Operation::Context.new }

  describe '#execute' do

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

    before do
      authorized_collection.drop
      authorized_collection.insert_one(test: 1)
      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: SpecConfig.instance.test_db })
    end

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

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mongo-2.16.4 spec/mongo/operation/indexes_spec.rb
mongo-2.17.4 spec/mongo/operation/indexes_spec.rb
mongo-2.18.3 spec/mongo/operation/indexes_spec.rb
mongo-2.18.2 spec/mongo/operation/indexes_spec.rb
mongo-2.17.3 spec/mongo/operation/indexes_spec.rb
mongo-2.18.1 spec/mongo/operation/indexes_spec.rb
mongo-2.18.0 spec/mongo/operation/indexes_spec.rb
mongo-2.17.2 spec/mongo/operation/indexes_spec.rb
mongo-2.16.3 spec/mongo/operation/indexes_spec.rb
mongo-2.18.0.beta1 spec/mongo/operation/indexes_spec.rb
mongo-2.16.2 spec/mongo/operation/indexes_spec.rb
mongo-2.17.1 spec/mongo/operation/indexes_spec.rb
mongo-2.16.1 spec/mongo/operation/indexes_spec.rb
mongo-2.17.0 spec/mongo/operation/indexes_spec.rb
mongo-2.16.0 spec/mongo/operation/indexes_spec.rb
mongo-2.15.1 spec/mongo/operation/indexes_spec.rb
mongo-2.16.0.alpha1 spec/mongo/operation/indexes_spec.rb
mongo-2.15.0 spec/mongo/operation/indexes_spec.rb