diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-19 07:04:14 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-19 07:04:14 +0000 |
| commit | 6a1b43aa6c3d2d90ce8659b30feeb5c0c8699cd4 (patch) | |
| tree | 149ce972dd5eeb9a3152ee547352122039af9088 /test | |
| parent | 6747b6a20b694e21296f1314c81a56e3cceef0d0 (diff) | |
| download | puppet-6a1b43aa6c3d2d90ce8659b30feeb5c0c8699cd4.tar.gz puppet-6a1b43aa6c3d2d90ce8659b30feeb5c0c8699cd4.tar.xz puppet-6a1b43aa6c3d2d90ce8659b30feeb5c0c8699cd4.zip | |
updating changes from the trunk
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1628 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rw-r--r-- | test/lib/exetest.rb | 4 | ||||
| -rw-r--r-- | test/lib/fakes.rb | 49 |
2 files changed, 50 insertions, 3 deletions
diff --git a/test/lib/exetest.rb b/test/lib/exetest.rb index 8e1568851..6efd93792 100644 --- a/test/lib/exetest.rb +++ b/test/lib/exetest.rb @@ -14,8 +14,8 @@ module ExeTest end def setbindir - unless ENV["PATH"] =~ /puppet/ - ENV["PATH"] += ":" + bindir + unless ENV["PATH"].split(":").include?(bindir) + ENV["PATH"] = [bindir, ENV["PATH"]].join(":") end end diff --git a/test/lib/fakes.rb b/test/lib/fakes.rb index d81c1fa5b..2b1d7c913 100644 --- a/test/lib/fakes.rb +++ b/test/lib/fakes.rb @@ -1,6 +1,6 @@ module PuppetTestFakes # A baseclass for the faketypes. - class FakeModel < Hash + class FakeModel class << self attr_accessor :name @name = :fakemodel @@ -14,7 +14,36 @@ module PuppetTestFakes Puppet::Type.type(@name).validstate?(name) end + def self.to_s + "Fake%s" % @name.to_s.capitalize + end + + def [](param) + if @realmodel.attrtype(param) == :state + @is[param] + else + @params[param] + end + end + + def []=(param, value) + unless @realmodel.attrtype(param) + raise Puppet::DevError, "Invalid attribute %s for %s" % + [param, @realmodel.name] + end + if @realmodel.attrtype(param) == :state + @should[param] = value + else + @params[param] = value + end + end + def initialize(name) + @realmodel = Puppet::Type.type(self.class.name) + raise "Could not find type #{self.class.name}" unless @realmodel + @is = {} + @should = {} + @params = {} self[:name] = name end @@ -22,6 +51,14 @@ module PuppetTestFakes "%s(%s)" % [self.class.to_s.sub(/.+::/, ''), super()] end + def is(param) + @is[param] + end + + def should(param) + @should[param] + end + def name self[:name] end @@ -49,6 +86,10 @@ module PuppetTestFakes @methods = ary end + def self.default? + false + end + def self.initvars @calls = Hash.new do |hash, key| hash[key] = 0 @@ -59,6 +100,10 @@ module PuppetTestFakes true end + def clear + @model = nil + end + def initialize(model) @model = model end @@ -97,3 +142,5 @@ module PuppetTestFakes module_function :fakeprovider end + +# $Id$ |
