Sha256: 36788d23585c4cf21023ec2a8d98eb6bfde87332bbae39670737e10ab08f37b3

Contents?: true

Size: 1.18 KB

Versions: 17

Compression:

Stored size: 1.18 KB

Contents

require 'lite_spec_helper'

describe 'Atlas connectivity' do
  shared_examples 'connects to Atlas' do
    let(:uri) { ENV[var] }
    let(:client) { Mongo::Client.new(uri) }

    before do
      if uri.nil?
        skip "#{var} not set in environment"
      end
    end

    it 'runs ismaster successfully' do
      result = client.database.command(:ismaster => 1)
      expect(result.documents.first['ismaster']).to be true
    end

    it 'runs findOne successfully' do
      result = client.use(:test)['test'].find.to_a
      expect(result).to be_a(Array)
    end
  end

  context 'Atlas replica set' do
    let(:var) { 'ATLAS_REPLICA_SET_URI' }

    it_behaves_like 'connects to Atlas'
  end

  context 'Atlas sharded cluster' do
    let(:var) { 'ATLAS_SHARDED_URI' }

    it_behaves_like 'connects to Atlas'
  end

  context 'Atlas free tier replica set' do
    let(:var) { 'ATLAS_FREE_TIER_URI' }

    it_behaves_like 'connects to Atlas'
  end

  context 'Atlas TLS 1.1 only replica set' do
    let(:var) { 'ATLAS_TLS11_URI' }

    it_behaves_like 'connects to Atlas'
  end

  context 'Atlas TLS 1.2 only replica set' do
    let(:var) { 'ATLAS_TLS12_URI' }

    it_behaves_like 'connects to Atlas'
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongo-2.8.0/spec/atlas/atlas_connectivity_spec.rb
mongo-2.9.2 spec/atlas/atlas_connectivity_spec.rb
mongo-2.9.1 spec/atlas/atlas_connectivity_spec.rb
mongo-2.9.1.rc0 spec/atlas/atlas_connectivity_spec.rb
mongo-2.9.0 spec/atlas/atlas_connectivity_spec.rb
mongo-2.9.0.rc1 spec/atlas/atlas_connectivity_spec.rb
mongo-2.9.0.rc0 spec/atlas/atlas_connectivity_spec.rb
mongo-2.8.0 spec/atlas/atlas_connectivity_spec.rb
mongo-2.7.2 spec/atlas/atlas_connectivity_spec.rb
mongo-2.8.0.rc0 spec/atlas/atlas_connectivity_spec.rb
mongo-2.7.1 spec/atlas/atlas_connectivity_spec.rb
mongo-2.7.0 spec/atlas/atlas_connectivity_spec.rb
mongo-2.7.0.rc0 spec/atlas/atlas_connectivity_spec.rb
mongo-2.6.4 spec/atlas/atlas_connectivity_spec.rb
mongo-2.6.2 spec/atlas/atlas_connectivity_spec.rb
mongo-2.6.1 spec/atlas/atlas_connectivity_spec.rb
mongo-2.6.0 spec/atlas/atlas_connectivity_spec.rb