Class: PuppetUnitTests::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- PuppetUnitTests::RakeTask
- Defined in:
- lib/puppet_unit_tests/rake_task.rb
Overview
Simple rake task to execute tests.
Instance Method Summary collapse
-
#initialize(name = :test, *args, &task_block) ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(name = :test, *args, &task_block) ⇒ RakeTask
Returns a new instance of RakeTask.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/puppet_unit_tests/rake_task.rb', line 11 def initialize(name = :test, *args, &task_block) super() @name = name desc "Run Puppet unit tests" unless ::Rake.application.last_description task(name, *args) do |_, task_args| yield(*[self, task_args].slice(0, task_block.arity)) if task_block runner = Runner.new begin errors = runner.run unless errors.empty? runner.format_errors(errors) abort("Puppet unit tests failed!") end rescue UserDataError => e warn("In file #{e.path}:") warn(" #{e.}") abort("Error in YAML test files") end end end |