From ea4fd867017083119a41f3a35a4b8ed6ad9fdbdc Mon Sep 17 00:00:00 2001 From: Raphaƫl Pinson Date: Thu, 11 Apr 2013 12:08:13 +0200 Subject: Prepare for rspec tests --- .fixtures.yml | 6 ++++++ .travis.yml | 15 +++++++++++++++ Gemfile | 13 +++++++++++++ Rakefile | 5 +++++ spec/.rspec | 6 ++++++ spec/fixtures/manifests/site.pp | 6 ++++++ spec/spec_helper.rb | 4 ++++ 7 files changed, 55 insertions(+) create mode 100644 .fixtures.yml create mode 100644 .travis.yml create mode 100644 Gemfile create mode 100644 Rakefile create mode 100644 spec/.rspec create mode 100644 spec/fixtures/manifests/site.pp create mode 100644 spec/spec_helper.rb diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..14caa2b --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,6 @@ +fixtures: + repositories: + "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" + "concat": "git://github.com/ripienaar/puppet-concat.git" + symlinks: + "dhcp": "#{source_dir}" diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6d7c0f8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: ruby +rvm: + - 1.8.7 + - 1.9.3 + - 2.0.0 + - ruby-head +env: + - PUPPET_GEM_VERSION=">= 3.0.0" +matrix: + allow_failures: + - rvm: 2.0.0 + - rvm: ruby-head + include: + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7" diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..a500d9e --- /dev/null +++ b/Gemfile @@ -0,0 +1,13 @@ +source :rubygems + +if ENV.key?('PUPPET_VERSION') + puppetversion = "= #{ENV['PUPPET_VERSION']}" +else + puppetversion = ['>= 2.7'] +end + +gem 'rake' +gem 'puppet-lint' +gem 'rspec-puppet' +gem 'puppet', puppetversion +gem 'puppetlabs_spec_helper', '>= 0.4.0' diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..4d31fec --- /dev/null +++ b/Rakefile @@ -0,0 +1,5 @@ +require 'puppet-lint/tasks/puppet-lint' +require 'puppetlabs_spec_helper/rake_tasks' + +task :default => [:spec, :lint] + diff --git a/spec/.rspec b/spec/.rspec new file mode 100644 index 0000000..91cd642 --- /dev/null +++ b/spec/.rspec @@ -0,0 +1,6 @@ +--format +s +--colour +--loadby +mtime +--backtrace diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp new file mode 100644 index 0000000..0380291 --- /dev/null +++ b/spec/fixtures/manifests/site.pp @@ -0,0 +1,6 @@ +# Fake $::concat_basedir fact +$concat_basedir = '/var/lib/puppet/concat' + +# Default node to test defines +node default { +} diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..4edc964 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,4 @@ +require 'mocha' +require 'rspec-puppet' +require 'puppetlabs_spec_helper/module_spec_helper' + -- cgit v1.2.3