Skip to content

Commit df7c59c

Browse files
author
Branan Purvine-Riley
committed
Update module to use puppetlabs_spec_helper gem
* Automatically populate fixtures directory on spec runs * Avoid duplicating spec_helper and Rakefile between modules
1 parent 4a0eb9d commit df7c59c

File tree

5 files changed

+21
-59
lines changed

5 files changed

+21
-59
lines changed

.fixtures.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
fixtures:
2+
repositories:
3+
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
4+
"concat": "git://github.com/ripienaar/puppet-concat.git"
5+
"keystone": "git://github.com/puppetlabs/puppetlabs-keystone.git"
6+
"memcached": "git://github.com/saz/puppet-memcached.git"
7+
"rsync": "git://github.com/puppetlabs/puppetlabs-rsync.git"
8+
"ssh": "git://github.com/saz/puppet-ssh.git"
9+
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
10+
"xinetd": "git://github.com/ghoneycutt/puppet-xinetd.git"
11+
symlinks:
12+
"swift": "#{source_dir}"

Gemfile renamed to .gemfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
source :rubygems
22

33
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 2.7']
4-
54
gem 'puppet', puppetversion
6-
7-
group :test do
8-
gem 'rake', '>= 0.9.0'
9-
gem 'rspec', '>= 2.8.0'
10-
gem 'rspec-puppet', '>= 0.1.1'
11-
end
5+
gem 'puppetlabs_spec_helper', '>= 0.1.0'

.travis.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
11
language: ruby
22
rvm:
33
- 1.8.7
4-
- 1.9.2
54
before_script:
6-
- 'git clone git://github.com/saz/puppet-ssh spec/fixtures/modules/ssh'
7-
- 'git clone git://github.com/puppetlabs/puppetlabs-rsync spec/fixtures/modules/rsync'
8-
- 'git clone git://github.com/ghoneycutt/puppet-xinetd spec/fixtures/modules/xinetd'
9-
- 'git clone git://github.com/saz/puppet-memcached spec/fixtures/modules/memcached'
10-
- 'git clone git://github.com/puppetlabs/puppetlabs-stdlib spec/fixtures/modules/stdlib'
11-
- 'git clone git://github.com/puppetlabs/puppet-apt spec/fixtures/modules/apt'
5+
after_script:
126
script: "rake spec"
137
branches:
148
only:
159
- master
1610
env:
17-
- PUPPET_VERSION=2.6.12
11+
- PUPPET_VERSION=2.6.9
1812
- PUPPET_VERSION=2.7.6
19-
- PUPPET_VERSION=2.7.11
20-
matrix:
21-
exclude:
22-
- rvm: 1.9.2
23-
env: PUPPET_VERSION=2.6.12
13+
- PUPPET_VERSION=2.7.13
14+
notifications:
15+
email: false
16+
gemfile: .gemfile

Rakefile

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1 @@
1-
require 'rubygems'
2-
require 'rake'
3-
require 'rspec/core/rake_task'
4-
5-
task :default do
6-
system("rake -T")
7-
end
8-
9-
task :specs => [:spec]
10-
11-
desc "Run all rspec-puppet tests"
12-
RSpec::Core::RakeTask.new(:spec) do |t|
13-
t.rspec_opts = ['--color']
14-
# ignores fixtures directory.
15-
t.pattern = 'spec/{classes,defines,unit}/**/*_spec.rb'
16-
end
17-
18-
desc "Build package"
19-
task :build do
20-
system("puppet-module build")
21-
end
1+
require 'puppetlabs_spec_helper/rake_tasks'

spec/spec_helper.rb

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
require 'puppet'
2-
require 'rubygems'
3-
require 'rspec-puppet'
4-
5-
def param_value(subject, type, title, param)
6-
subject.resource(type, title).send(:parameters)[param.to_sym]
7-
end
8-
9-
def verify_contents(subject, title, expected_lines)
10-
content = subject.resource('file', title).send(:parameters)[:content]
11-
(content.split("\n") & expected_lines).should == expected_lines
12-
end
13-
14-
RSpec.configure do |c|
15-
c.module_path = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/modules'))
16-
# Using an empty site.pp file to avoid: https://github.com/rodjek/rspec-puppet/issues/15
17-
c.manifest_dir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures/manifests'))
18-
end
1+
require 'puppetlabs_spec_helper/module_spec_helper'

0 commit comments

Comments
 (0)