diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..30514c4 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,5 @@ +fixtures: + repositories: + stdlib: git://github.com/puppetlabs/puppetlabs-stdlib.git + symlinks: + arpwatch: "#{source_dir}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..01d0a08 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +pkg/ diff --git a/metadata.json b/metadata.json index dafbba0..77b66e0 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "ardichoke-arpwatch", - "version": "0.1.1", + "version": "0.1.2", "author": "ardichoke", "summary": "Install and manage arpwatch", "license": "Apache-2.0", @@ -17,6 +17,8 @@ ] } ], - "dependencies": [], + "dependencies": [ + { "name": "puppetlabs/stdlib", "version_requirement": ">=1.0.0 <5.0.0"}, + ], "tags": ["arpwatch","network","monitoring"] } diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb new file mode 100644 index 0000000..7f3011b --- /dev/null +++ b/spec/classes/init_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' +describe 'arpwatch', type: 'class' do + context 'On RedHat 7 with no parameters' do + let (:facts) { { osfamily: 'RedHat', operatingsystemmajrelease: '7' } } + it { + should contain_package('arpwatch').with({'ensure'=>'installed'}) + should contain_file('/etc/sysconfig/arpwatch').with({'ensure'=>'file'}) + } + end + context 'On RedHat 6 with no parameters' do + let (:facts) { { osfamily: 'RedHat', operatingsystemmajrelease: '6' } } + it { + should contain_package('arpwatch').with({'ensure'=>'installed'}) + should contain_file('/etc/sysconfig/arpwatch').with({'ensure'=>'file'}) + } + end + context 'On RedHat 5 with no parameters' do + let (:facts) { { osfamily: 'RedHat', operatingsystemmajrelease: '6' } } + it { + should contain_package('arpwatch').with({'ensure'=>'installed'}) + should contain_file('/etc/sysconfig/arpwatch').with({'ensure'=>'file'}) + } + end + context 'On an unknown OS' do + let :facts do + { + :osfamily => 'Darwin' + } + end + it { + expect { should raise_error(Puppet::Error) } + } + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..2fca0c0 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,6 @@ +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') +end