diff --git a/manifests/init.pp b/manifests/init.pp index 54998bc..3b52ee5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -22,18 +22,18 @@ } ~> package { 'teams': - ensure => installed, + ensure => latest, require => Apt::Source['teams'], } } default: { - notify { 'Unsupported architecture': } + fail('Teams only runs on AMD64, your architecture is unsupported.') } } } default: { - notify { 'Unsupported OS': } + fail('The Teams installer module only works with Debian derivatives, your distribution is unsupported.') } } } diff --git a/spec/classes/teams_spec.rb b/spec/classes/teams_spec.rb index 4fd26de..c59881e 100644 --- a/spec/classes/teams_spec.rb +++ b/spec/classes/teams_spec.rb @@ -24,4 +24,26 @@ it { is_expected.to contain_package('teams').with('require' => 'Apt::Source[teams]') } end end + context 'should fail on Pis' do + let(:facts) do + { + 'os' => { + 'architecture' => 'armv7l', + }, + } + end + + it { is_expected.not_to compile } # this is how to test for the 'fail' built-in function because 'fail' results in a compilation error + end # end of the Pi context + context 'should fail on RedHat-like OSes' do + let(:facts) do + { + 'os' => { + 'operatingsystem' => 'CentOS', + }, + } + end + + it { is_expected.not_to compile } # this is how to test for the 'fail' built-in function because 'fail' results in a compilation error + end # end of the Pi context end