diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..92ec3b5 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,10 @@ +fixtures: + symlinks: + "alternc": "#{source_dir}" + forge_modules: + "apt": + repo: "puppetlabs/apt" + ref: "4.5.1" + "stdlib": + repo: "puppetlabs/stdlib" + ref: "4.16.0" diff --git a/spec/classes/bureau_spec.rb b/spec/classes/bureau_spec.rb new file mode 100644 index 0000000..f2cdb7c --- /dev/null +++ b/spec/classes/bureau_spec.rb @@ -0,0 +1,49 @@ +require 'spec_helper' +describe 'alternc::bureau' do + let(:title) { 'alternc' } + let(:params) { + { + 'database_password' => 'asdf', + 'database_mail_password' => 'asdf', + } + } + # Need to fill out a fair amounts of facts for the apt module. + let(:facts) { + { + :operatingsystem => 'Debian', + :osfamily => 'Debian', + :os => { + 'name' => 'Debian', + 'lsb' => { + 'distcodename' => 'stretch', + 'majdistrelease' => '9' + }, + 'release' => { + 'full' => '', + 'major' => '9' + } + }, + :ipaddress => '10.0.0.2', + } + } + + it do + is_expected.to contain_file('/var/lib/dpkg/alternc.response') + is_expected.to contain_package('alternc').with( + 'ensure' => 'present', + 'name' => 'alternc' + ) + is_expected.to contain_class('alternc::source') + end + + context 'with manage_sources => false' do + let(:params) { + { + 'database_password' => 'asdf', + 'database_mail_password' => 'asdf', + 'manage_sources' => false + } + } + it { is_expected.not_to contain_class('alternc::source') } + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..b684e24 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,11 @@ +require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet' + +fixture_path = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures') + +RSpec.configure do |c| + c.module_path = File.join(fixture_path, 'modules') + c.manifest_dir = File.join(fixture_path, 'manifests') + c.manifest = File.join(fixture_path, 'manifests', 'site.pp') + c.environmentpath = File.join(Dir.pwd, 'spec') +end