module-puppetlabs-apt/spec/classes/params_spec.rb

40 lines
1.6 KiB
Ruby
Raw Normal View History

require 'spec_helper'
describe 'apt::params', :type => :class do
2015-04-27 20:31:39 +02:00
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :puppetversion => '3.5.0', } }
let (:title) { 'my_package' }
it { is_expected.to contain_apt__params }
# There are 4 resources in this class currently
# there should not be any more resources because it is a params class
# The resources are class[apt::params], class[main], class[settings], stage[main]
it "Should not contain any resources" do
expect(subject.call.resources.size).to eq(4)
end
2014-02-27 10:23:11 +01:00
describe "With lsb-release not installed" do
2015-04-27 20:31:39 +02:00
let(:facts) { { :osfamily => 'Debian', :puppetversion => '3.5.0', } }
let (:title) { 'my_package' }
it do
expect {
subject.call
}.to raise_error(Puppet::Error, /Unable to determine lsbdistid, please install lsb-release first/)
end
end
2015-04-27 20:31:39 +02:00
describe "With old puppet version" do
let(:facts) { { :lsbdistid => 'Debian', :osfamily => 'Debian', :lsbdistcodename => 'wheezy', :lsbdistrelease => 'foo', :lsbdistdescription => 'bar', :lsbminordistrelease => 'baz', :lsbmajdistrelease => 'foobar', :puppetversion => '3.4.0', } }
let(:title) { 'my_package' }
it { is_expected.to contain_apt__params }
# There are 4 resources in this class currently
# there should not be any more resources because it is a params class
# The resources are class[apt::params], class[main], class[settings], stage[main]
it "Should not contain any resources" do
expect(subject.call.resources.size).to eq(4)
end
end
end