Sha256: 1aee92dbab9acac032a04cf70c4e72c8a1fcd000b22504b03c63ffb1e4a4c616

Contents?: true

Size: 1.5 KB

Versions: 18

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'lite_spec_helper'

require 'runners/auth'

describe 'Auth' do
  include Mongo::Auth

  AUTH_TESTS.each do |file|
    spec = Mongo::Auth::Spec.new(file)

    context(spec.description) do
      spec.tests.each_with_index do |test, index|
        context test.description do
          if test.description.downcase.include?("gssapi")
            require_mongo_kerberos
          end

          if test.valid?

            context 'the auth configuration is valid' do
              if test.credential

                it 'creates a client with options matching the credential' do
                  expect(test.actual_client_options).to eq(test.expected_credential)
                end

                it 'creates a user with attributes matching the credential' do
                  expect(test.actual_user_attributes).to eq(test.expected_credential)
                end
              else

                context 'with empty credentials' do
                  it 'creates a client with no credential information' do
                    expect(test.client).to have_blank_credentials
                  end
                end
              end
            end

          else

            context 'the auth configuration is invalid' do
              it 'raises an error' do
                expect do
                  test.client
                end.to raise_error(Mongo::Auth::InvalidConfiguration)
              end
            end

          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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