1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
# frozen_string_literal: true
# rubocop:todo all
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
|