Browse Source

Merge pull request #31 from pdxcat/fix_release_parameter_test

Modify apt::source release verification to work correctly with puppet-rspec
Nan Liu 12 years ago
parent
commit
44fd06c4a4
2 changed files with 8 additions and 6 deletions
  1. 1 2
      manifests/source.pp
  2. 7 4
      spec/defines/source_spec.rb

+ 1 - 2
manifests/source.pp

@@ -16,7 +16,7 @@ define apt::source(
 
   include apt::params
 
-  if ! $release {
+  if $release == undef {
     fail("lsbdistcodename fact not available: release parameter required")
   }
 
@@ -27,7 +27,6 @@ define apt::source(
     group => root,
     mode => 644,
     content => template("apt/source.list.erb"),
-
   }
 
   if $pin != false {

+ 7 - 4
spec/defines/source_spec.rb

@@ -136,8 +136,11 @@ describe 'apt::source', :type => :define do
       }
     end
   end
-    describe "without release should raise a Puppet::Error" do
-      it { expect { should contain_apt__source(:release) }.to raise_error(Puppet::Error) }
-    end
+  describe "without release should raise a Puppet::Error" do
+    let(:default_params) { Hash.new }
+    let(:facts) { Hash.new }
+    it { expect { should raise_error(Puppet::Error) } }
+    let(:facts) { { :lsbdistcodename => 'lucid' } }
+    it { should contain_apt__source(title) }
+  end
 end
-