Sha256: 8bd4decc41fbbb0705765cfd99d8f54122ba846694d803da077e14a2f0c19613

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require 'puppet/module_tool'

describe Puppet::Module::Tool do
  describe 'http_proxy support' do
    before :each do
      ENV["http_proxy"] = nil
    end

    after :each do
      ENV["http_proxy"] = nil
    end

    it "should support environment variable for port and host" do
      ENV["http_proxy"] = "http://test.com:8011"
      described_class.http_proxy_host.should == "test.com"
      described_class.http_proxy_port.should == 8011
    end

    it "should support puppet configuration for port and host" do
      ENV["http_proxy"] = nil
      Puppet.settings.stubs(:[]).with(:http_proxy_host).returns('test.com')
      Puppet.settings.stubs(:[]).with(:http_proxy_port).returns(7456)

      described_class.http_proxy_port.should == 7456
      described_class.http_proxy_host.should == "test.com"
    end

    it "should use environment variable before puppet settings" do
      ENV["http_proxy"] = "http://test1.com:8011"
      Puppet.settings.stubs(:[]).with(:http_proxy_host).returns('test2.com')
      Puppet.settings.stubs(:[]).with(:http_proxy_port).returns(7456)

      described_class.http_proxy_host.should == "test1.com"
      described_class.http_proxy_port.should == 8011
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-2.7.11 spec/unit/module_tool_spec.rb
puppet-2.7.9 spec/unit/module_tool_spec.rb