Adding specs for proxy and apt::ppa
authorHunter Haugen <h.haugen@gmail.com>
Thu, 11 Jul 2013 22:49:00 +0000 (15:49 -0700)
committerHunter Haugen <h.haugen@gmail.com>
Thu, 11 Jul 2013 22:49:00 +0000 (15:49 -0700)
spec/defines/ppa_spec.rb

index 6be9ab91426d5247dbf1544c03e828e7e64ce779..3baa7e86572fde065302a52258349ae4200611e4 100644 (file)
@@ -55,6 +55,31 @@ describe 'apt::ppa', :type => :define do
           }
         end
       end
           }
         end
       end
+      describe 'behind a proxy' do
+        let :title do
+          'rspec_ppa'
+        end
+        let :pre_condition do
+          'class { "apt":
+            proxy_host => "user:pass@proxy",
+          }'
+        end
+          let :filename do
+            "#{title}-#{release}.list"
+          end
+
+        it { should contain_exec("add-apt-repository-#{title}").with(
+          'environment' => [
+            "http_proxy=http://user:pass@proxy:8080",
+            "https_proxy=http://user:pass@proxy:8080",
+          ],
+          'command'     => "/usr/bin/add-apt-repository #{title}",
+          'creates'     => "/etc/apt/sources.list.d/#{filename}",
+          'require'     => ["File[/etc/apt/sources.list.d]", "Package[#{package}]"],
+          'notify'      => "Exec[apt_update]"
+          )
+        }
+      end
     end
   end
 
     end
   end