Skip to content

Commit

Permalink
Update for the new puppetlabs_spec_helper gem
Browse files Browse the repository at this point in the history
* Add automatic fixtures creation to `rake spec`
* Remove recursive symlink
* Prepend fixtures modulepath instead of overriding
* Update travis for the new automagical rake spec
  • Loading branch information
Branan Purvine-Riley committed May 31, 2012
1 parent 02ceb1b commit 2d0d759
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 72 deletions.
6 changes: 6 additions & 0 deletions .fixtures.yml
@@ -0,0 +1,6 @@
fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
symlinks:
"nodejs": "#{source_dir}"
5 changes: 5 additions & 0 deletions .gemfile
@@ -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'
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -2,8 +2,6 @@ language: ruby
rvm:
- 1.8.7
before_script:
- "git clone git://github.com/puppetlabs/puppetlabs-apt.git spec/fixtures/modules/apt
- "git clone git://github.com/puppetlabs/puppetlabs-stdlib.git spec/fixtures/modules/stdlib"
after_script:
script: "rake spec"
branches:
Expand All @@ -15,3 +13,4 @@ env:
- PUPPET_VERSION=2.6.9
notifications:
email: false
gemfile: .gemfile
13 changes: 0 additions & 13 deletions Gemfile

This file was deleted.

36 changes: 1 addition & 35 deletions Rakefile
@@ -1,35 +1 @@
require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'

task :default do
system("rake -T")
end

task :specs => [:spec]

desc "Run all rspec-puppet tests"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ['--color']
# ignores fixtures directory.
t.pattern = 'spec/{classes,defines,unit}/**/*_spec.rb'
end

desc "Build puppet module package"
task :build do
# This will be deprecated once puppet-module is a face.
begin
Gem::Specification.find_by_name('puppet-module')
rescue Gem::LoadError, NoMethodError
require 'puppet/face'
pmod = Puppet::Face['module', :current]
pmod.build('./')
end
end

desc "Check puppet manifests with puppet-lint"
task :lint do
# This requires pull request: https://github.com/rodjek/puppet-lint/pull/81
system("puppet-lint manifests")
system("puppet-lint tests")
end
require 'puppetlabs_spec_helper/rake_tasks'
1 change: 0 additions & 1 deletion spec/fixtures/modules/nodejs

This file was deleted.

22 changes: 1 addition & 21 deletions spec/spec_helper.rb
@@ -1,21 +1 @@
require 'puppet'
require 'mocha'
require 'rspec'
require 'rspec-puppet'
require 'rspec/expectations'
require 'puppetlabs_spec_helper'

def param_value(subject, type, title, param)
subject.resource(type, title).send(:parameters)[param.to_sym]
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'))
# Use fixtures for config file mainly to support using our own hiera.yaml settings.
# Pending: https://github.com/rodjek/rspec-puppet/pull/21
# c.config = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/puppet.conf'))
#
c.mock_with :mocha
end
require 'puppetlabs_spec_helper/module_spec_helper'

0 comments on commit 2d0d759

Please sign in to comment.