浏览代码

Merge pull request #18 from bodepd/apt_proxy_tests

(#12529) Add unit test for apt proxy settings
Matthaus Litteken 12 年之前
父节点
当前提交
52adc3555c
共有 1 个文件被更改,包括 15 次插入1 次删除
  1. 15 1
      spec/classes/apt_spec.rb

+ 15 - 1
spec/classes/apt_spec.rb

@@ -10,7 +10,9 @@ describe 'apt', :type => :class do
   [{},
    {
       :disable_keys => true,
-      :always_apt_update => true
+      :always_apt_update => true,
+      :proxy_host => true,
+      :proxy_port => '3128'
     }
   ].each do |param_set|
     describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
@@ -74,6 +76,18 @@ describe 'apt', :type => :class do
           })
         end
       }
+      describe 'when setting a proxy' do
+        it {
+          if param_hash[:proxy_host]
+            should contain_file('configure-apt-proxy').with(
+              'path'    => '/etc/apt/apt.conf.d/proxy',
+              'content' => "Acquire::http::Proxy \"http://#{param_hash[:proxy_host]}:#{param_hash[:proxy_port]}\";"
+            )
+          else
+            should_not contain_file('configure_apt_proxy')
+          end
+        }
+      end
     end
   end
 end