Add start of rspec tests for bureau class

This commit is contained in:
Kienan Stewart 2018-07-26 20:23:52 -04:00
parent 4c5b1bc932
commit 184bcd5be9
3 changed files with 70 additions and 0 deletions

10
.fixtures.yml Normal file
View File

@ -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"

View File

@ -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

11
spec/spec_helper.rb Normal file
View File

@ -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