diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..7e5bd413 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +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/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' +script: "rake spec" +branches: + only: + - master +env: + - PUPPET_VERSION=2.6.12 + - PUPPET_VERSION=2.7.6 + - PUPPET_VERSION=2.7.11 +matrix: + exclude: + - rvm: 1.9.2 + env: PUPPET_VERSION=2.6.12 diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..45d24e25 --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +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 diff --git a/Rakefile b/Rakefile index 6242a370..e7852c35 100644 --- a/Rakefile +++ b/Rakefile @@ -1,14 +1,21 @@ +require 'rubygems' require 'rake' +require 'rspec/core/rake_task' -task :default => [:spec] +task :default do + system("rake -T") +end -desc "Run all module spec tests (Requires rspec-puppet gem)" -task :spec do - system("rspec spec/**/*_spec.rb") +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 - diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp new file mode 100644 index 00000000..e69de29b diff --git a/spec/fixtures/modules/swift b/spec/fixtures/modules/swift new file mode 120000 index 00000000..1b20c9fb --- /dev/null +++ b/spec/fixtures/modules/swift @@ -0,0 +1 @@ +../../../ \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d2648da2..0b8c6b3f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,5 +7,7 @@ def param_value(subject, type, title, param) end RSpec.configure do |c| - c.module_path = File.join(File.dirname(__FILE__), '../../') + 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