Sha256: 0984f86ab89936458136517dfb3da708ff62da4fa44e41d9ffc1f57dacd9e06d

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require 'lite_spec_helper'

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

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

          context 'when the auth configuration is valid' do
            context 'with empty credentials', if: test.valid? && test.credential.nil? do
              it 'creates a client with no credential information' do
                expect(test.client).to have_blank_credentials
              end
            end

            it 'creates a client with the correct credentials', if: test.valid? && test.credential do
              expect(test.received_credential).to eq(test.expected_credential)
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongo-2.12.4 spec/spec_tests/auth_spec.rb
mongo-2.12.3 spec/spec_tests/auth_spec.rb
mongo-2.12.2 spec/spec_tests/auth_spec.rb
mongo-2.12.1 spec/spec_tests/auth_spec.rb
mongo-2.12.0.rc0 spec/spec_tests/auth_spec.rb