65759fad1d3e8929226a3843deeb1f868fc60ac6
[puppet-modules/puppetlabs-apt.git] / spec / classes / params_spec.rb
1 require 'spec_helper'
2 describe 'apt::params', :type => :class do
3   let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian' } }
4   let (:title) { 'my_package' }
5
6   it { is_expected.to contain_apt__params }
7
8   # There are 4 resources in this class currently
9   # there should not be any more resources because it is a params class
10   # The resources are class[apt::params], class[main], class[settings], stage[main]
11   it "Should not contain any resources" do
12     expect(subject.resources.size).to eq(4)
13   end
14
15   describe "With unknown lsbdistid" do
16
17     let(:facts) { { :lsbdistid => 'CentOS', :osfamily => 'Debian' } }
18     let (:title) { 'my_package' }
19
20     it do
21       expect {
22        is_expected.to compile
23       }.to raise_error(Puppet::Error, /Unsupported lsbdistid/)
24     end
25
26   end
27
28   describe "With lsb-release not installed" do
29     let(:facts) { { :lsbdistid => '', :osfamily => 'Debian' } }
30     let (:title) { 'my_package' }
31
32     it do
33       expect {
34         is_expected.to compile
35       }.to raise_error(Puppet::Error, /Unable to determine lsbdistid, is lsb-release installed/)
36     end
37   end
38
39 end