Permalink
Browse files

Update for the new puppetlabs_spec_helper gem

* 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...
1 parent 02ceb1b commit 2d0d75950313f267084de3304104204ed06b6ab7 @branan branan committed May 25, 2012
Showing with 14 additions and 72 deletions.
  1. +6 −0 .fixtures.yml
  2. +5 −0 .gemfile
  3. +1 −2 .travis.yml
  4. +0 −13 Gemfile
  5. +1 −35 Rakefile
  6. +0 −1 spec/fixtures/modules/nodejs
  7. +1 −21 spec/spec_helper.rb
View
@@ -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}"
View
@@ -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
@@ -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:
@@ -15,3 +13,4 @@ env:
- PUPPET_VERSION=2.6.9
notifications:
email: false
+gemfile: .gemfile
View
13 Gemfile
@@ -1,13 +0,0 @@
-source :rubygems
-
-puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
-
-gem 'puppet', puppetversion
-
-group :test do
- gem 'rake', '>= 0.9.0'
- gem 'rspec', '>= 2.8.0'
- gem 'rspec-puppet', '>= 0.1.1'
- gem 'mocha', '>= 0.11.0'
- gem 'puppet-lint', '>= 0.1.0'
-end
View
@@ -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'
View
@@ -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.