test/other/propertychange.rb in puppet-0.22.4 vs test/other/propertychange.rb in puppet-0.23.0
- old
+ new
@@ -8,17 +8,17 @@
require 'puppettest'
class TestPropertyChange < Test::Unit::TestCase
include PuppetTest
class FakeProperty < Puppet::Type::Property
- attr_accessor :is, :should, :parent
+ attr_accessor :is, :should, :resource
attr_reader :noop
- def change_to_s
+ def change_to_s(currentvalue, newvalue)
"fake change"
end
- def insync?
- @is == @should
+ def insync?(is)
+ is == @should
end
def log(msg)
Puppet::Util::Log.create(
:level => :info,
:source => self,
@@ -33,15 +33,15 @@
end
end
def path
"fakechange"
end
- def should_to_s
- @should.to_s
+ def should_to_s(newvalue)
+ newvalue.to_s
end
def sync
- if insync?
+ if insync?(@is)
return nil
else
@is = @should
return :fake_change
end
@@ -50,17 +50,17 @@
path
end
end
def mkchange
- property = FakeProperty.new :parent => "fakeparent"
+ property = FakeProperty.new :resource => "fakeparent"
property.is = :start
property.should = :finish
- property.parent = :parent
+ property.resource = :parent
change = nil
assert_nothing_raised do
- change = Puppet::PropertyChange.new(property)
+ change = Puppet::PropertyChange.new(property, :start)
end
change.transaction = :trans
assert_equal(:start, change.is, "@is did not get copied")
assert_equal(:finish, change.should, "@should did not get copied")
@@ -123,11 +123,10 @@
assert(! change.skip?, "Change is already being skipped")
Puppet[:noop] = true
change.property.noop = true
- p change.property.noop
assert(change.noop, "did not set noop")
assert(change.skip?, "setting noop did not mark change for skipping")
event = nil
assert_nothing_raised("Could not generate noop event") do
@@ -137,6 +136,6 @@
assert_equal(1, event.length, "got wrong number of events")
assert_equal(:noop, event[0].event, "did not generate noop mode when in noop")
end
end
-# $Id: propertychange.rb 2286 2007-03-17 23:16:37Z luke $
+# $Id: propertychange.rb 2517 2007-05-15 19:22:36Z luke $