Merge pull request #657 from puppetlabs/binford2k-patch-1
[puppet-modules/puppetlabs-apt.git] / spec / defines / ppa_spec.rb
index 74b52ea9c94fba1a82f69bd14de522786e2e8102..f95776f6ee83dfa386d4c5f379a3fea59e550814 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,7 @@ 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',
     })
@@ -31,6 +32,7 @@ describe 'apt::ppa' do
   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',
@@ -44,7 +46,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 -y ppa:user/foo',
-      :unless      => '/usr/bin/test -s /etc/apt/sources.list.d/user-ubuntu-foo-wily.list',
+      :unless      => '/usr/bin/test -f /etc/apt/sources.list.d/user-ubuntu-foo-wily.list',
       :user        => 'root',
       :logoutput   => 'on_failure',
     })
@@ -69,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',
@@ -83,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',
     })
@@ -104,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',
@@ -123,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',
     })
@@ -141,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',
@@ -160,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',
     })
@@ -180,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',
@@ -201,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',
     })
@@ -216,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',
@@ -235,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',
     })
@@ -250,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',
@@ -269,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',
     })
@@ -284,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',
@@ -303,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',
     })
@@ -316,6 +325,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',
@@ -340,6 +350,7 @@ describe 'apt::ppa' do
     describe 'no release' do
       let :facts do
         {
+          :os => { :family => 'Debian', :name => 'Ubuntu', :release => { :major => '14', :full => '14.04' }},
           :lsbdistrelease  => '14.04',
           :operatingsystem => 'Ubuntu',
           :lsbdistid       => 'Ubuntu',
@@ -359,6 +370,7 @@ describe 'apt::ppa' do
     describe 'not ubuntu' do
       let :facts do
         {
+          :os => { :family => 'Debian', :name => 'Debian', :release => { :major => '6', :full => '6.0.7' }},
           :lsbdistrelease  => '6.0.7',
           :lsbdistcodename => 'wheezy',
           :operatingsystem => 'Debian',