Update to use puppetlabs_spec_helper gem

* Automatically populate fixtures directory on spec runs
* Avoid duplicating spec_helper and Rakefile between modules
* Prepend fixtures to modulepath instead of overriding
* Remove recursive symlink in fixtures dir
This commit is contained in:
Branan Purvine-Riley 2012-05-31 17:18:34 -07:00
parent bfc6f8990d
commit afba13ed26
5 changed files with 16 additions and 33 deletions

9
.fixtures.yml Normal file
View File

@ -0,0 +1,9 @@
fixtures:
repositories:
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
"keystone": "git://github.com/puppetlabs/puppetlabs-keystone.git"
"mysql": "git://github.com/puppetlabs/puppetlabs-mysql.git"
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"sysctl": "git://github.com/duritong/puppet-sysctl.git"
symlinks:
"nova": "#{source_dir}"

5
.gemfile Normal file
View File

@ -0,0 +1,5 @@
source :rubygems
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'

View File

@ -1,14 +1 @@
require 'rake'
require 'rubygems'
require 'rspec/core/rake_task'
task :default => [:spec]
desc "Run all module spec tests (Requires rspec-puppet gem)"
RSpec::Core::RakeTask.new(:spec)
desc "Build package"
task :build do
system("puppet-module build")
end
require 'puppetlabs_spec_helper/rake_tasks'

View File

@ -1 +0,0 @@
../../../../nova

View File

@ -1,18 +1 @@
require 'puppet'
require 'rspec'
require 'rspec-puppet'
def param_value(subject, type, title, param)
subject.resource(type, title).send(:parameters)[param.to_sym]
end
def verify_contents(subject, title, expected_lines)
content = subject.resource('file', title).send(:parameters)[:content]
(content.split("\n") & expected_lines).should == expected_lines
end
RSpec.configure do |c|
c.module_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/modules/'))
# Using an empty site.pp file to avoid: https://github.com/rodjek/rspec-puppet/issues/15
c.manifest_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/manifests'))
end
require 'puppetlabs_spec_helper/module_spec_helper'