From e39eee9324c5203ff3825aea22f9a5836ab9bce4 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 27 Aug 2012 17:08:07 -0700 Subject: Add puppetlabs_spec_helper gem code --- .fixtures.yml | 5 +++++ Rakefile | 9 +-------- spec/spec.opts | 6 ++++++ spec/spec_helper.rb | 14 +------------- 4 files changed, 13 insertions(+), 21 deletions(-) create mode 100644 .fixtures.yml create mode 100644 spec/spec.opts diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..8d6f22d --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,5 @@ +fixtures: + repositories: + concat: "git://github.com/ripienaar/puppet-concat.git" + symlinks: + haproxy: "#{source_dir}" diff --git a/Rakefile b/Rakefile index aa737b9..cd3d379 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1 @@ -require 'rake' -require 'puppet-lint/tasks/puppet-lint' -require 'rspec/core/rake_task' - -RSpec::Core::RakeTask.new(:spec) do |t| - t.rspec_opts = '-c' - t.pattern = 'spec/*/*_spec.rb' -end +require 'puppetlabs_spec_helper/rake_tasks' diff --git a/spec/spec.opts b/spec/spec.opts new file mode 100644 index 0000000..91cd642 --- /dev/null +++ b/spec/spec.opts @@ -0,0 +1,6 @@ +--format +s +--colour +--loadby +mtime +--backtrace diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9dbbf18..2c6f566 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,13 +1 @@ -require 'puppet' -require 'rubygems' -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 - -class Object - alias :must :should -end +require 'puppetlabs_spec_helper/module_spec_helper' -- cgit v1.2.3 From 4e59418ffd2f2694b9af1fb9af3faaf8d19efaf0 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 27 Aug 2012 17:10:12 -0700 Subject: Remove git submodule fixtures in place of puppetlabs_spec_helper fixtures behaviour --- .gitmodules | 3 --- README.md | 5 ++--- spec/fixtures/manifests/site.pp | 0 spec/fixtures/modules/concat | 1 - spec/fixtures/modules/haproxy | 1 - 5 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 .gitmodules delete mode 100644 spec/fixtures/manifests/site.pp delete mode 160000 spec/fixtures/modules/concat delete mode 120000 spec/fixtures/modules/haproxy diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 033526f..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "spec/fixtures/modules/concat"] - path = spec/fixtures/modules/concat - url = git://github.com/ripienaar/puppet-concat.git diff --git a/README.md b/README.md index 9c1f90c..10657ab 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,9 @@ requests accepted! ## Hacking -After cloning the repository, execute `git submodule update --init` to pull in -any dependencies needed to test the module locally. +After cloning the repository: -1. `git submodule update --init` +1. `gem install puppetlabs_spec_helper` 1. `rake spec` # To run the tests 1. Hack Hack Hack # Adding tests hopefully! 1. Commit and send a pull request! diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp deleted file mode 100644 index e69de29..0000000 diff --git a/spec/fixtures/modules/concat b/spec/fixtures/modules/concat deleted file mode 160000 index 52dbf4a..0000000 --- a/spec/fixtures/modules/concat +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 52dbf4a61a0a47b82b5213def9fe19b7af47a498 diff --git a/spec/fixtures/modules/haproxy b/spec/fixtures/modules/haproxy deleted file mode 120000 index 1b20c9f..0000000 --- a/spec/fixtures/modules/haproxy +++ /dev/null @@ -1 +0,0 @@ -../../../ \ No newline at end of file -- cgit v1.2.3 From aba70abc83d4a7c947356cc16cd1ac366288945c Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 27 Aug 2012 17:11:02 -0700 Subject: Add $concat_basedir custom fact variable for spec tests --- spec/classes/haproxy_spec.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/classes/haproxy_spec.rb b/spec/classes/haproxy_spec.rb index 4c90b18..46c8124 100644 --- a/spec/classes/haproxy_spec.rb +++ b/spec/classes/haproxy_spec.rb @@ -4,7 +4,10 @@ describe 'haproxy', :type => :class do context 'on Redhat family operatingsystems' do let(:facts) do - { :osfamily => 'Redhat' } + { + :osfamily => 'Redhat', + :concat_basedir => '/dne' + } end it { should include_class('concat::setup') } @@ -58,4 +61,4 @@ describe 'haproxy', :type => :class do }.to raise_error(Puppet::Error, /operating system is not supported with the haproxy module/) end end -end \ No newline at end of file +end -- cgit v1.2.3