Puppet 4 language update
[puppet-modules/puppetlabs-apt.git] / spec / defines / ppa_spec.rb
index 1e7e23a42f1a5864aed25572c37ac2f9ffc04e22..ae66087e88ada8af3afa81127b73590292ca9138 100644 (file)
@@ -7,6 +7,7 @@ describe 'apt::ppa' do
   describe 'defaults' do
     let :facts do
       {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '11', :full => '11.04' }},
         :lsbdistrelease  => '11.04',
         :lsbdistcodename => 'natty',
         :operatingsystem => 'Ubuntu',
@@ -21,7 +22,31 @@ describe 'apt::ppa' do
     it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow+type').that_notifies('Class[Apt::Update]').with({
       :environment => [],
       :command     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow+type',
-      :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow_type-natty.list',
+      :unless      => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow_type-natty.list',
+      :user        => 'root',
+      :logoutput   => 'on_failure',
+    })
+    }
+  end
+
+  describe 'Ubuntu 15.10 sources.list filename' do
+    let :facts do
+      {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '15', :full => '15.10' }},
+        :lsbdistrelease  => '15.10',
+        :lsbdistcodename => 'wily',
+        :operatingsystem => 'Ubuntu',
+        :osfamily        => 'Debian',
+        :lsbdistid       => 'Ubuntu',
+        :puppetversion   => Puppet.version,
+      }
+    end
+
+    let(:title) { 'ppa:user/foo' }
+    it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({
+      :environment => [],
+      :command     => '/usr/bin/add-apt-repository -y ppa:user/foo',
+      :unless      => '/usr/bin/test -f /etc/apt/sources.list.d/user-ubuntu-foo-wily.list',
       :user        => 'root',
       :logoutput   => 'on_failure',
     })
@@ -46,6 +71,7 @@ describe 'apt::ppa' do
     end
     let :facts do
       {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '11', :full => '11.04' }},
         :lsbdistrelease  => '11.04',
         :lsbdistcodename => 'natty',
         :operatingsystem => 'Ubuntu',
@@ -60,7 +86,7 @@ describe 'apt::ppa' do
     it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with({
       'environment' => [],
       'command'     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
-      'unless'      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
+      'unless'      => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
       'user'        => 'root',
       'logoutput'   => 'on_failure',
     })
@@ -81,6 +107,7 @@ describe 'apt::ppa' do
     end
     let :facts do
       {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '11', :full => '11.04' }},
         :lsbdistrelease  => '11.04',
         :lsbdistcodename => 'natty',
         :operatingsystem => 'Ubuntu',
@@ -100,7 +127,7 @@ describe 'apt::ppa' do
     it { is_expected.to contain_exec('add-apt-repository-ppa:user/bar').that_notifies('Class[Apt::Update]').with({
       'environment' => [],
       'command'     => '/usr/bin/add-apt-repository -y ppa:user/bar',
-      'unless'      => '/usr/bin/test -s /etc/apt/sources.list.d/user-bar-natty.list',
+      'unless'      => '/usr/bin/test -f /etc/apt/sources.list.d/user-bar-natty.list',
       'user'        => 'root',
       'logoutput'   => 'on_failure',
     })
@@ -118,6 +145,7 @@ describe 'apt::ppa' do
     end
     let :facts do
       {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '11', :full => '11.04' }},
         :lsbdistrelease  => '11.04',
         :lsbdistcodename => 'natty',
         :operatingsystem => 'Ubuntu',
@@ -137,7 +165,7 @@ describe 'apt::ppa' do
     it { is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with({
       'environment' => [],
       'command'     => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow',
-      'unless'      => '/usr/bin/test -s /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
+      'unless'      => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-natty.list',
       'user'        => 'root',
       'logoutput'   => 'on_failure',
     })
@@ -157,6 +185,7 @@ describe 'apt::ppa' do
     end
     let :facts do
       {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
         :lsbdistrelease  => '14.04',
         :lsbdistcodename => 'trusty',
         :operatingsystem => 'Ubuntu',
@@ -178,7 +207,7 @@ describe 'apt::ppa' do
     it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({
       :environment => [],
       :command     => '/usr/bin/add-apt-repository  ppa:user/foo',
-      :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/user-foo-trusty.list',
+      :unless      => '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
       :user        => 'root',
       :logoutput   => 'on_failure',
     })
@@ -193,6 +222,7 @@ describe 'apt::ppa' do
     end
     let :facts do
       {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
         :lsbdistrelease  => '14.04',
         :lsbdistcodename => 'trusty',
         :operatingsystem => 'Ubuntu',
@@ -212,7 +242,7 @@ describe 'apt::ppa' do
     it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({
       :environment => ['http_proxy=http://localhost:8080'],
       :command     => '/usr/bin/add-apt-repository  ppa:user/foo',
-      :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/user-foo-trusty.list',
+      :unless      => '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
       :user        => 'root',
       :logoutput   => 'on_failure',
     })
@@ -227,6 +257,7 @@ describe 'apt::ppa' do
     end
     let :facts do
       {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
         :lsbdistrelease  => '14.04',
         :lsbdistcodename => 'trusty',
         :operatingsystem => 'Ubuntu',
@@ -246,7 +277,7 @@ describe 'apt::ppa' do
     it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({
       :environment => ['http_proxy=http://localhost:8180'],
       :command     => '/usr/bin/add-apt-repository  ppa:user/foo',
-      :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/user-foo-trusty.list',
+      :unless      => '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
       :user        => 'root',
       :logoutput   => 'on_failure',
     })
@@ -261,6 +292,7 @@ describe 'apt::ppa' do
     end
     let :facts do
       {
+        :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
         :lsbdistrelease  => '14.04',
         :lsbdistcodename => 'trusty',
         :operatingsystem => 'Ubuntu',
@@ -280,7 +312,7 @@ describe 'apt::ppa' do
     it { is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with({
       :environment => ['http_proxy=http://localhost:8180', 'https_proxy=https://localhost:8180'],
       :command     => '/usr/bin/add-apt-repository  ppa:user/foo',
-      :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/user-foo-trusty.list',
+      :unless      => '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
       :user        => 'root',
       :logoutput   => 'on_failure',
     })