Sha256: 25fa9f4dd48fa1f92e1b8d88873a77838f27b38c5497b28536e7f95a129188fb

Contents?: true

Size: 925 Bytes

Versions: 1

Compression:

Stored size: 925 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe LdapQuery::Config do

  describe 'without valid hash' do
    it { expect { described_class.new }.to raise_error(ArgumentError) }
    it { expect { described_class.new({}) }.to raise_error(ArgumentError) }
    it { expect { described_class.new(123) }.to raise_error(ArgumentError) }
  end

  describe 'should convert specific keys/values to symbols' do
    subject(:config) { config = described_class.new({ david: 'friends', 'base' => '123', username: 'foo', password: 'bar', method: 'simple', host: 'company.tld' }) }

    it { expect(config.method).to eq(:simple) }
  end

  describe 'required keys missing' do
    it 'should raise with ' do
      expect { described_class.new({ port: 123, david: 'friends' }) }.to raise_error(LdapQuery::ConfigError, 'required config values ([:base, :username, :password, :host, :port]) can not be nil')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ldap_query-0.0.1 spec/ldap_lookup/config_spec.rb