Sha256: 975eee7b7a48e4b4ebddf386c3e85d84f746ffccc99714f3eaa3fd82e1f4fdc3
Contents?: true
Size: 1.27 KB
Versions: 17
Compression:
Stored size: 1.27 KB
Contents
# encoding: utf-8 require 'spec_helper' describe HttpProxy do context '#initialize' do it 'requires a connection string' do expect { HttpProxy.new('localhost:8080') }.not_to raise_error end it 'fails on invalid connection string' do expect { HttpProxy.new('gargabe:asdf') }.to raise_error Exceptions::ProxyConnectionStringInvalid end end context '#to_string' do it 'generates a string' do proxy = HttpProxy.new('localhost:8080') expect(proxy.to_string).to eq('http://localhost:8080') end it 'uses a user and output no password' do user = double('ProxyUser') allow(user).to receive(:name).and_return('user') expect(user).not_to receive(:password) proxy = HttpProxy.new('localhost:8080') proxy.use_user user expect(proxy.to_string).to eq('http://user:****@localhost:8080') end it 'uses a user and output password on request' do user = double('ProxyUser') allow(user).to receive(:name).and_return('user') allow(user).to receive(:password).and_return('password') proxy = HttpProxy.new('localhost:8080') proxy.use_user user expect(proxy.to_string(cleartext: true)).to eq('http://user:password@localhost:8080') end end end
Version data entries
17 entries across 17 versions & 1 rubygems