Convert apt::source to use apt::setting
[puppet-modules/puppetlabs-apt.git] / spec / classes / params_spec.rb
index a0ec08ca4bdff4ad82b92ec3b8d25ff0f89553cf..9a75ade4dbaae38f82ac897ee1df7044f2411884 100644 (file)
@@ -1,8 +1,9 @@
 require 'spec_helper'
 describe 'apt::params', :type => :class do
+  let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
   let (:title) { 'my_package' }
 
-  it { should create_class("apt::params") }
+  it { should contain_apt__params }
 
   # There are 4 resources in this class currently
   # there should not be any more resources because it is a params class
@@ -10,4 +11,29 @@ describe 'apt::params', :type => :class do
   it "Should not contain any resources" do
     subject.resources.size.should == 4
   end
+
+  describe "With unknown lsbdistid" do
+
+    let(:facts) { { :lsbdistid => 'CentOS', :osfamily => 'Debian' } }
+    let (:title) { 'my_package' }
+
+    it do
+      expect {
+       should compile
+      }.to raise_error(Puppet::Error, /Unsupported lsbdistid/)
+    end
+
+  end
+
+  describe "With lsb-release not installed" do
+    let(:facts) { { :lsbdistid => '', :osfamily => 'Debian' } }
+    let (:title) { 'my_package' }
+
+    it do
+      expect {
+        should compile
+      }.to raise_error(Puppet::Error, /Unable to determine lsbdistid, is lsb-release installed/)
+    end
+  end
+
 end