summaryrefslogtreecommitdiffstats
path: root/spec/lib/autotest/puppet_rspec.rb
blob: 8536f39120212a7430644ed122a2edc0a086098f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
        },

    # 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!
	},

	# the spec_helper
	%r!^spec/spec_helper\.rb$! => proc { |filename, _|
          files_matching %r!spec/(unit|integration)/.*\.rb!
	},

	# the puppet test libraries
	%r!^test/lib/puppettest/.*! => proc { |filename, _|
          files_matching %r!spec/(unit|integration)/.*\.rb!
	},

        # the puppet spec libraries
	%r!^spec/lib/spec.*! => proc { |filename, _|
          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
end