Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for the new puppetlabs_spec_helper gem #11

Merged
merged 1 commit into from
Jun 8, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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'