diff --git a/.fixtures.yml b/.fixtures.yml index f42623f..7d5b6e7 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -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}" diff --git a/.gitignore b/.gitignore index 01d0a08..6ba09a0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,12 @@ pkg/ +.*.sw? +spec/fixtures +Gemfile.lock +.rspec_system +.vagrant +.bundle +vendor +junit +log +.yardoc +coverage diff --git a/spec/classes/bind_spec.rb b/spec/classes/bind_spec.rb index 6b24cb5..569dc7c 100644 --- a/spec/classes/bind_spec.rb +++ b/spec/classes/bind_spec.rb @@ -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({ diff --git a/spec/fixtures/hiera/common.yaml b/spec/fixtures/hiera/common.yaml deleted file mode 100644 index cd55b7f..0000000 --- a/spec/fixtures/hiera/common.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -bind::defaults::confdir: '_CONFDIR_' -bind::defaults::namedconf: '_NAMEDCONF_' diff --git a/spec/fixtures/hiera/hiera.yaml b/spec/fixtures/hiera/hiera.yaml deleted file mode 100644 index f3e0521..0000000 --- a/spec/fixtures/hiera/hiera.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -:hierarchy: - - "tests/%{::test_config}" - - common -:backends: - - yaml - - module_data -:yaml: - :datadir: 'spec/fixtures/hiera' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f7b76c3..168db47 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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