Merge branch '1.4.x'
[puppet-modules/puppetlabs-apt.git] / spec / acceptance / apt_ppa_spec.rb
index 5948461421322e40142a81d27844d03554943aba..cc6970a6e0cb233ea29a266954abe441b6bdb904 100644 (file)
@@ -50,12 +50,51 @@ if fact('operatingsystem') == 'Ubuntu'
       end
     end
 
+    context 'ensure' do
+      context 'present' do
+        it 'works without failure' do
+          pp = <<-EOS
+          include '::apt'
+          apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => present }
+          EOS
+
+          apply_manifest(pp, :catch_failures => true)
+        end
+
+        describe 'contains the source file' do
+          it 'contains a kernel ppa source' do
+            shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [0])
+          end
+        end
+      end
+    end
+
+    context 'ensure' do
+      context 'absent' do
+        it 'works without failure' do
+          pp = <<-EOS
+          include '::apt'
+          apt::ppa { 'ppa:canonical-kernel-team/ppa': ensure => absent }
+          EOS
+
+          apply_manifest(pp, :catch_failures => true)
+        end
+
+        describe 'doesnt contain the source file' do
+          it 'fails' do
+            shell('ls /etc/apt/sources.list.d/canonical-kernel-team-ppa-*', :acceptable_exit_codes => [2])
+          end
+        end
+      end
+    end
+
     context 'release' do
       context 'precise' do
         it 'works without failure' do
           pp = <<-EOS
           include '::apt'
           apt::ppa { 'ppa:canonical-kernel-team/ppa':
+            ensure  => present,
             release => precise,
           }
           EOS
@@ -76,6 +115,7 @@ if fact('operatingsystem') == 'Ubuntu'
           pp = <<-EOS
           include '::apt'
           apt::ppa { 'ppa:canonical-kernel-team/ppa':
+            ensure  => present,
             release => precise,
             options => '-y',
           }