|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +# |
| 4 | +# Copyright 2020, Optimizely and contributors |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +# |
| 18 | +require 'spec_helper' |
| 19 | +require 'optimizely/config/proxy_config' |
| 20 | + |
| 21 | +describe Optimizely::ProxyConfig do |
| 22 | + let(:host) { 'host' } |
| 23 | + let(:port) { 1234 } |
| 24 | + let(:username) { 'username' } |
| 25 | + let(:password) { 'password' } |
| 26 | + |
| 27 | + describe '#initialize' do |
| 28 | + it 'defines getters for host, port, username, and password' do |
| 29 | + proxy_config = described_class.new(host, port, username, password) |
| 30 | + |
| 31 | + expect(proxy_config.host).to eq(host) |
| 32 | + expect(proxy_config.port).to eq(port) |
| 33 | + expect(proxy_config.username).to eq(username) |
| 34 | + expect(proxy_config.password).to eq(password) |
| 35 | + end |
| 36 | + |
| 37 | + it 'sets port, username, and password to nil if they are not passed in' do |
| 38 | + proxy_config = described_class.new(host) |
| 39 | + expect(proxy_config.port).to eq(nil) |
| 40 | + expect(proxy_config.username).to eq(nil) |
| 41 | + expect(proxy_config.password).to eq(nil) |
| 42 | + end |
| 43 | + end |
| 44 | +end |
0 commit comments