diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 00000000..61d375d0 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,12 @@ +fixtures: + repositories: + "apt": "git://github.com/puppetlabs/puppetlabs-apt.git" + "concat": "git://github.com/ripienaar/puppet-concat.git" + "keystone": "git://github.com/puppetlabs/puppetlabs-keystone.git" + "memcached": "git://github.com/saz/puppet-memcached.git" + "rsync": "git://github.com/puppetlabs/puppetlabs-rsync.git" + "ssh": "git://github.com/saz/puppet-ssh.git" + "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" + "xinetd": "git://github.com/ghoneycutt/puppet-xinetd.git" + symlinks: + "swift": "#{source_dir}" diff --git a/Gemfile b/.gemfile similarity index 55% rename from Gemfile rename to .gemfile index 45d24e25..9aad840c 100644 --- a/Gemfile +++ b/.gemfile @@ -1,11 +1,5 @@ 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' -end +gem 'puppetlabs_spec_helper', '>= 0.1.0' diff --git a/.travis.yml b/.travis.yml index bdef0752..5124296d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,16 @@ language: ruby rvm: - 1.8.7 - - 1.9.2 before_script: - - 'git clone git://github.com/saz/puppet-ssh spec/fixtures/modules/ssh' - - 'git clone git://github.com/puppetlabs/puppetlabs-rsync spec/fixtures/modules/rsync' - - 'git clone git://github.com/ghoneycutt/puppet-xinetd spec/fixtures/modules/xinetd' - - 'git clone git://github.com/saz/puppet-memcached spec/fixtures/modules/memcached' - - 'git clone git://github.com/puppetlabs/puppetlabs-stdlib spec/fixtures/modules/stdlib' - - 'git clone git://github.com/puppetlabs/puppet-apt spec/fixtures/modules/apt' +after_script: script: "rake spec" branches: only: - master env: - - PUPPET_VERSION=2.6.12 + - PUPPET_VERSION=2.6.9 - PUPPET_VERSION=2.7.6 - - PUPPET_VERSION=2.7.11 -matrix: - exclude: - - rvm: 1.9.2 - env: PUPPET_VERSION=2.6.12 + - PUPPET_VERSION=2.7.13 +notifications: + email: false +gemfile: .gemfile \ No newline at end of file diff --git a/Rakefile b/Rakefile index e7852c35..cd3d3799 100644 --- a/Rakefile +++ b/Rakefile @@ -1,21 +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 package" -task :build do - system("puppet-module build") -end +require 'puppetlabs_spec_helper/rake_tasks' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8d6d4c31..2c6f5664 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,18 +1 @@ -require 'puppet' -require 'rubygems' -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'