diff --git a/.dependency_decisions.yml b/.dependency_decisions.yml index 265ddd01..78698538 100644 --- a/.dependency_decisions.yml +++ b/.dependency_decisions.yml @@ -89,3 +89,10 @@ :why: https://github.com/masover/blankslate/blob/f0a73b80c34bc3ad94dc3195d12a227a8fe30019/MIT-LICENSE :versions: [] :when: 2017-11-17 14:05:09.534340925 Z +- - :license + - puppetlabs_spec_helper + - Apache 2.0 + - :who: DavidS + :why: + :versions: [] + :when: 2018-03-09 18:04:29.175843919 Z diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 00000000..bf4c5dc9 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,8 @@ +# This file can be used to install module depdencies for unit testing +# See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details +--- +fixtures: + forge_modules: +# stdlib: "puppetlabs/stdlib" + symlinks: + test_module: "#{source_dir}/spec/fixtures/test_module" diff --git a/.gitignore b/.gitignore index 8eb3b06b..dedffc53 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ # rspec failure tracking .rspec_status + +# puppetlabs_spec_helper automatic fixtures +spec/fixtures/modules/test_module diff --git a/Gemfile b/Gemfile index ccc7855a..8b2fa581 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,9 @@ group :tests do gem 'rubocop-rspec' gem 'rubocop' gem 'simplecov-console' + # the test gems required for module testing + gem 'puppetlabs_spec_helper', github: 'DavidS/puppetlabs_spec_helper', ref: 'refactor' + gem 'rspec-puppet' end group :development do @@ -39,5 +42,5 @@ end if ENV['PUPPET_GEM_VERSION'] gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) else - gem 'puppet', git: 'https://github.com/DavidS/puppet', ref: 'device-apply' + gem 'puppet', github: 'DavidS/puppet', ref: 'device-apply' end diff --git a/Rakefile b/Rakefile index bc1f5624..c4b4ccae 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,5 @@ require 'bundler/gem_tasks' +require 'puppetlabs_spec_helper/tasks/fixtures' task :default => :spec @@ -13,7 +14,9 @@ end require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| - excludes = ['fixtures/**/*.rb'] + Rake::Task[:spec_prep].invoke + # thanks to the fixtures/modules/ symlinks this needs to exclude fixture modules explicitely + excludes = ['fixtures/**/*.rb,fixtures/modules/*/**/*.rb'] if RUBY_PLATFORM == 'java' excludes += ['acceptance/**/*.rb', 'integration/**/*.rb', 'puppet/resource_api/*_context_spec.rb', 'puppet/util/network_device/simple/device_spec.rb'] t.rspec_opts = '--tag ~agent_test' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7eea1494..18da6220 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,6 +31,7 @@ require 'bundler/setup' require 'puppet/resource_api' +require 'puppetlabs_spec_helper/module_spec_helper' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure @@ -42,4 +43,7 @@ config.expect_with :rspec do |c| c.syntax = :expect end + + # override legacy default from puppetlabs_spec_helper + config.mock_with :rspec end