Spec tests are now running correctly

This commit is contained in:
Cedric DEFORTIS 2017-04-27 11:38:53 +02:00 committed by Cédric Defortis
parent a992774aab
commit 189fc932e7
6 changed files with 53 additions and 41 deletions

View File

@ -2,8 +2,7 @@ fixtures:
forge_modules:
concat:
repo: "puppetlabs/concat"
ref: "1.0.0"
ref: "2.2.1"
stdlib: "puppetlabs/stdlib"
module_data: "ripienaar/module_data"
symlinks:
bind: "#{source_dir}"

11
.gitignore vendored
View File

@ -1 +1,12 @@
pkg/
.*.sw?
spec/fixtures
Gemfile.lock
.rspec_system
.vagrant
.bundle
vendor
junit
log
.yardoc
coverage

View File

@ -7,29 +7,33 @@ describe 'bind' do
{
:concat_basedir => '/wtf',
:osfamily => 'Debian',
:os => {
:family => 'Debian',
},
:operatingsystem => 'Debian'
}
end
it {
it { is_expected.to compile }
it do
should contain_package('bind-tools').with({
'ensure' => 'latest',
'name' => 'dnsutils'
}).that_comes_before('Package[bind]')
}
it {
should contain_package('bind').with({
'ensure' => 'latest',
'name' => 'bind9'
ensure: 'present',
name: 'dnsutils'
})
}
end
it do
should contain_package('bind').with({
ensure: 'latest',
name: 'bind9'
})
end
it { should contain_file('_NAMEDCONF_').that_requires('Package[bind]') }
it { should contain_file('_NAMEDCONF_').that_notifies('Service[bind]') }
it { should contain_file('/etc/bind/named.conf').that_requires('Package[bind]') }
it { should contain_file('/etc/bind/named.conf').that_notifies('Service[bind]') }
it {
should contain_service('bind').with({
'ensure' => 'running',
'name' => 'bind9'
ensure: 'running',
name: 'bind9'
})
}
end
@ -38,12 +42,15 @@ describe 'bind' do
{
:concat_basedir => '/wtf',
:osfamily => 'RedHat',
:os => {
:family => 'RedHat',
},
:operatingsystem => 'CentOS'
}
end
it {
should contain_package('bind-tools').with({
'ensure' => 'latest',
'ensure' => 'present',
'name' => 'bind-utils'
})
}
@ -54,8 +61,8 @@ describe 'bind' do
})
}
it { should contain_file('_NAMEDCONF_').that_requires('Package[bind]') }
it { should contain_file('_NAMEDCONF_').that_notifies('Service[bind]') }
it { should contain_file('/etc/named.conf').that_requires('Package[bind]') }
it { should contain_file('/etc/named.conf').that_notifies('Service[bind]') }
it {
should contain_service('bind').with({

View File

@ -1,3 +0,0 @@
---
bind::defaults::confdir: '_CONFDIR_'
bind::defaults::namedconf: '_NAMEDCONF_'

View File

@ -1,9 +0,0 @@
---
:hierarchy:
- "tests/%{::test_config}"
- common
:backends:
- yaml
- module_data
:yaml:
:datadir: 'spec/fixtures/hiera'

View File

@ -1,14 +1,21 @@
require 'puppetlabs_spec_helper/module_spec_helper'
require 'fixtures/modules/module_data/lib/hiera/backend/module_data_backend.rb'
require 'rspec-puppet-facts'
include RspecPuppetFacts
require 'simplecov'
require 'simplecov-console'
SimpleCov.start do
add_filter '/spec'
add_filter '/vendor'
formatter SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console
])
end
RSpec.configure do |c|
c.default_facts = {
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:lsbdistcodename => 'wheezy',
:architecture => 'amd64',
:kernel => 'Linux',
:test_config => 'default'
}
c.hiera_config = File.join('spec', 'fixtures', 'hiera', 'hiera.yaml')
c.hiera_config = File.expand_path(File.join(__FILE__, '../fixtures/hiera.yaml'))
end