~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to autotest/puppet_rspec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mfrom: (1.1.8 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080726154345-c03m49twzxewdwjn
Tags: 0.24.5-2
* Fix puppetlast to work with 0.24.5
* Adjust logcheck to match against new log messages in 0.24.5
* Update standards version to 3.8.0 (no changes)
* Update changelog to reduce length of line to make lintian happy

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require 'autotest'
 
2
require 'autotest/rspec'
 
3
 
 
4
Autotest.add_hook :initialize do |at|
 
5
    at.clear_mappings
 
6
 
 
7
    # the libraries under lib/puppet
 
8
    at.add_mapping(%r%^lib/puppet/(.*)\.rb$%) { |filename, m|
 
9
        at.files_matching %r!spec/(unit|integration)/#{m[1]}.rb!
 
10
    }
 
11
 
 
12
    # the actual spec files themselves
 
13
    at.add_mapping(%r%^spec/(unit|integration)/.*\.rb$%) { |filename, _|
 
14
        filename
 
15
    }
 
16
 
 
17
    # force a complete re-run for all of these:
 
18
 
 
19
        # main puppet lib
 
20
        at.add_mapping(%r!^lib/puppet\.rb$!) { |filename, _|
 
21
        at.files_matching %r!spec/(unit|integration)/.*\.rb!
 
22
        }
 
23
 
 
24
        # the spec_helper
 
25
        at.add_mapping(%r!^spec/spec_helper\.rb$!) { |filename, _|
 
26
        at.files_matching %r!spec/(unit|integration)/.*\.rb!
 
27
        }
 
28
 
 
29
        # the puppet test libraries
 
30
        at.add_mapping(%r!^test/lib/puppettest/.*!) { |filename, _|
 
31
        at.files_matching %r!spec/(unit|integration)/.*\.rb!
 
32
        }
 
33
 
 
34
        # the puppet spec libraries
 
35
        at.add_mapping(%r!^spec/lib/spec.*!) { |filename, _|
 
36
        at.files_matching %r!spec/(unit|integration)/.*\.rb!
 
37
        }
 
38
 
 
39
        # the monkey patches for rspec
 
40
        at.add_mapping(%r!^spec/lib/monkey_patches/.*!) { |filename, _|
 
41
        at.files_matching %r!spec/(unit|integration)/.*\.rb!
 
42
        }
 
43
end
 
44
 
 
45
class Autotest::PuppetRspec < Autotest::Rspec
 
46
  # Autotest will look for spec commands in the following
 
47
  # locations, in this order:
 
48
  #
 
49
  #   * bin/spec
 
50
  #   * default spec bin/loader installed in Rubygems
 
51
  #   * our local vendor/gems/rspec/bin/spec
 
52
  def spec_commands
 
53
    [
 
54
      File.join('vendor', 'gems', 'rspec', 'bin', 'spec') ,
 
55
      File.join('bin', 'spec'),
 
56
      File.join(Config::CONFIG['bindir'], 'spec')
 
57
    ]
 
58
  end
 
59
 
 
60
end