summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Barton <barton.tomas@gmail.com>2013-10-13 18:14:45 +0200
committerTomas Barton <barton.tomas@gmail.com>2013-10-13 18:14:45 +0200
commit342ea7aa15a54c33ec4a12cf10b7b1a0c9811dba (patch)
tree584a96ab49087874d83c3ad43df37eeb4fb9cf84
parentb729e3903ded13e07501fc9b55766d21de206ae8 (diff)
extended tests, first group should pass
-rw-r--r--.travis.yml1
-rw-r--r--spec/classes/munin_client_spec.rb14
-rw-r--r--spec/classes/munin_host_spec.rb23
-rw-r--r--spec/spec_helper.rb6
4 files changed, 29 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml
index 3e66a86..330677c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,7 @@ rvm:
- 1.8.7
- 1.9.3
- 2.0.0
+script: 'rake spec'
env:
- PUPPET_VERSION=2.6.0
- PUPPET_VERSION=2.7.0
diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb
index a5539b3..ebf8d73 100644
--- a/spec/classes/munin_client_spec.rb
+++ b/spec/classes/munin_client_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe 'munin::client' do
- shared_examples 'debian' do |os, codename|
+ shared_examples 'debian-client' do |os, codename|
let(:facts) {{
:operatingsystem => os,
:osfamily => 'Debian',
@@ -10,9 +10,10 @@ describe 'munin::client' do
it { should contain_package('munin-node') }
it { should contain_package('iproute') }
it { should contain_file('/etc/munin/munin-node.conf') }
+ it { should include_class('munin::client::debian') }
end
- shared_examples 'redhat' do |os, codename|
+ shared_examples 'redhat-client' do |os, codename|
let(:facts) {{
:operatingsystem => os,
:osfamily => 'RedHat',
@@ -24,13 +25,13 @@ describe 'munin::client' do
end
context 'on debian-like system' do
- it_behaves_like 'debian', 'Debian', 'squeeze'
- it_behaves_like 'debian', 'Debian', 'wheezy'
- it_behaves_like 'debian', 'Ubuntu', 'precise'
+ it_behaves_like 'debian-client', 'Debian', 'squeeze'
+ it_behaves_like 'debian-client', 'Debian', 'wheezy'
+ it_behaves_like 'debian-client', 'Ubuntu', 'precise'
end
context 'on redhat-like system' do
- it_behaves_like 'redhat', 'CentOS', '6'
+ it_behaves_like 'redhat-client', 'CentOS', '6'
# not supported yet
# it_behaves_like 'redhat', 'RedHat', '6'
end
@@ -44,6 +45,7 @@ describe 'munin::client' do
}}
it { should contain_package('munin-node') }
it { should contain_file('/etc/munin/munin-node.conf') }
+ it { should include_class('munin::client::gentoo') }
end
end
diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb
index 2216cc5..ccfcee6 100644
--- a/spec/classes/munin_host_spec.rb
+++ b/spec/classes/munin_host_spec.rb
@@ -1,14 +1,21 @@
require 'spec_helper'
describe 'munin::host' do
- let :facts do
- {
- :operatingsystem => 'CentOS',
- :interfaces => 'lo,eth0',
- }
+ shared_examples 'debian-host' do |os, codename|
+ let(:facts) {{
+ :operatingsystem => os,
+ :osfamily => 'Debian',
+ :lsbdistcodename => codename,
+ :concat_basedir => '/var/lib/puppet/concat',
+ }}
+ it { should contain_package('munin') }
+ it { should contain_file('/etc/munin/munin.conf') }
end
- it 'should compile' do
- should include_class('munin::host')
- end
+# context 'on debian-like system' do
+# it_behaves_like 'debian-host', 'Debian', 'squeeze'
+# it_behaves_like 'debian', 'Debian', 'wheezy'
+# it_behaves_like 'debian', 'Ubuntu', 'precise'
+# end
+
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index cffe80c..7269ae5 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,9 +1,13 @@
require 'puppetlabs_spec_helper/module_spec_helper'
+require 'rspec-puppet'
+
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
- c.mock_with :mocha
end
+
+Puppet::Util::Log.level = :warning
+Puppet::Util::Log.newdestination(:console)