(maint) Update the gpg key
[puppet-modules/puppetlabs-apt.git] / spec / defines / source_spec.rb
index c9863dd96f12216601ffdf7308a07305802ac76d..bf6977a39dd0e0f4cf456bf890615f1010391bc2 100644 (file)
@@ -1,7 +1,7 @@
 require 'spec_helper'
 
 describe 'apt::source' do
-  GPG_KEY_ID = '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30'
+  GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F'
 
   let :pre_condition do
     'class { "apt": }'
@@ -70,6 +70,8 @@ describe 'apt::source' do
       }).with_content(/hello.there wheezy main\n/)
       }
 
+      it { is_expected.to contain_file('/etc/apt/sources.list.d/my_source.list').that_notifies('Class[Apt::Update]')}
+
       it { is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with({
         :ensure       => 'present',
         :priority     => 1001,
@@ -225,7 +227,7 @@ describe 'apt::source' do
 
     it { is_expected.to contain_apt__setting('list-my_source').with({
       :ensure => 'present',
-    }).with_content(/# my_source\ndeb-src \[arch=x86_64 \] hello.there wheezy main\n/)
+    }).with_content(/# my_source\ndeb-src \[arch=x86_64\] hello.there wheezy main\n/)
     }
   end
 
@@ -385,5 +387,58 @@ describe 'apt::source' do
       end
     end
 
+    context "with notify_update = undef (default)" do
+      let :facts do
+        {
+          :lsbdistid       => 'Debian',
+          :lsbdistcodename => 'wheezy',
+          :osfamily        => 'Debian',
+          :puppetversion   => Puppet.version,
+        }
+      end
+      let :params do
+        {
+          :location      => 'hello.there',
+        }
+      end
+      it { is_expected.to contain_apt__setting("list-#{title}").with_notify_update(true) }
+    end
+
+    context "with notify_update = true" do
+      let :facts do
+        {
+          :lsbdistid       => 'Debian',
+          :lsbdistcodename => 'wheezy',
+          :osfamily        => 'Debian',
+          :puppetversion   => Puppet.version,
+        }
+      end
+      let :params do
+        {
+          :location      => 'hello.there',
+          :notify_update => true,
+        }
+      end
+      it { is_expected.to contain_apt__setting("list-#{title}").with_notify_update(true) }
+    end
+
+    context "with notify_update = false" do
+      let :facts do
+        {
+          :lsbdistid       => 'Debian',
+          :lsbdistcodename => 'wheezy',
+          :osfamily        => 'Debian',
+          :puppetversion   => Puppet.version,
+        }
+      end
+      let :params do
+        {
+          :location      => 'hello.there',
+          :notify_update => false,
+        }
+      end
+      it { is_expected.to contain_apt__setting("list-#{title}").with_notify_update(false) }
+    end
+
   end
 end