summaryrefslogtreecommitdiffstats
path: root/autotest
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-12 22:24:12 -0600
committerLuke Kanies <luke@madstop.com>2008-02-12 22:24:12 -0600
commiteb740336d418273eea726f653280dae7553da605 (patch)
treeae0b8d255bf757c68ed374f73aa5eebd3f2d990c /autotest
parent1b90f7f8b523b32439e17f27b9f924bea8f1e74b (diff)
downloadpuppet-eb740336d418273eea726f653280dae7553da605.tar.gz
puppet-eb740336d418273eea726f653280dae7553da605.tar.xz
puppet-eb740336d418273eea726f653280dae7553da605.zip
Fixing the puppet_rspec autotest plugin to use the modern interface
Diffstat (limited to 'autotest')
-rw-r--r--autotest/puppet_rspec.rb59
1 files changed, 29 insertions, 30 deletions
diff --git a/autotest/puppet_rspec.rb b/autotest/puppet_rspec.rb
index fc537e016..bfc1a6a43 100644
--- a/autotest/puppet_rspec.rb
+++ b/autotest/puppet_rspec.rb
@@ -1,49 +1,48 @@
require 'autotest'
require 'autotest/rspec'
-class Autotest::PuppetRspec < Autotest::Rspec
- def initialize # :nodoc:
- super
- @test_mappings = {
- # the libraries under lib/puppet
- %r%^lib/puppet/(.*)\.rb$% => proc { |filename, m|
- files_matching %r!spec/(unit|integration)/#{m[1]}.rb!
- },
-
- # the actual spec files themselves
- %r%^spec/(unit|integration)/.*\.rb$% => proc { |filename, _|
- filename
- },
+Autotest.add_hook :initialize do |at|
+ at.clear_mappings
+
+ # the libraries under lib/puppet
+ at.add_mapping(%r%^lib/puppet/(.*)\.rb$%) { |filename, m|
+ at.files_matching %r!spec/(unit|integration)/#{m[1]}.rb!
+ }
+
+ # the actual spec files themselves
+ at.add_mapping(%r%^spec/(unit|integration)/.*\.rb$%) { |filename, _|
+ filename
+ }
# force a complete re-run for all of these:
# main puppet lib
- %r!^lib/puppet\.rb$! => proc { |filename, _|
- files_matching %r!spec/(unit|integration)/.*\.rb!
- },
+ at.add_mapping(%r!^lib/puppet\.rb$!) { |filename, _|
+ at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ }
# the spec_helper
- %r!^spec/spec_helper\.rb$! => proc { |filename, _|
- files_matching %r!spec/(unit|integration)/.*\.rb!
- },
+ at.add_mapping(%r!^spec/spec_helper\.rb$!) { |filename, _|
+ at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ }
# the puppet test libraries
- %r!^test/lib/puppettest/.*! => proc { |filename, _|
- files_matching %r!spec/(unit|integration)/.*\.rb!
- },
+ at.add_mapping(%r!^test/lib/puppettest/.*!) { |filename, _|
+ at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ }
# the puppet spec libraries
- %r!^spec/lib/spec.*! => proc { |filename, _|
- files_matching %r!spec/(unit|integration)/.*\.rb!
- },
+ at.add_mapping(%r!^spec/lib/spec.*!) { |filename, _|
+ at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ }
# the monkey patches for rspec
- %r!^spec/lib/monkey_patches/.*! => proc { |filename, _|
- files_matching %r!spec/(unit|integration)/.*\.rb!
- },
- }
- end
+ at.add_mapping(%r!^spec/lib/monkey_patches/.*!) { |filename, _|
+ at.files_matching %r!spec/(unit|integration)/.*\.rb!
+ }
+end
+class Autotest::PuppetRspec < Autotest::Rspec
# Autotest will look for spec commands in the following
# locations, in this order:
#