summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-04 16:32:04 -0500
committerLuke Kanies <luke@madstop.com>2008-07-04 16:32:04 -0500
commit9d69b3fd12f90ddead7b6a3392395fbe4e901d9b (patch)
treebd8a4e16ed9c0e34568ea321d152e786f1e6090a /spec
parent61ec332144ad794fae80a16feac543afc014a5f9 (diff)
Testing and simplifying the Transaction::Change#backward method.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/transaction/change.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/transaction/change.rb b/spec/unit/transaction/change.rb
index 3312b12e8..eaa6fb4ab 100755
--- a/spec/unit/transaction/change.rb
+++ b/spec/unit/transaction/change.rb
@@ -146,6 +146,37 @@ describe Puppet::Transaction::Change do
@change.forward.should == [:uno, :dos]
end
end
+
+ describe "backward" do
+ before do
+ @property = stub 'property'
+ @property.stub_everything
+ @property.stubs(:should).returns "shouldval"
+ @change = Change.new(@property, "value")
+ @change.stubs :go
+ end
+
+ it "should swap the 'is' and 'should' values" do
+ @change.backward
+ @change.is.should == "shouldval"
+ @change.should.should == "value"
+ end
+
+ it "should set the 'should' value on the property to the previous 'is' value" do
+ @property.expects(:should=).with "value"
+ @change.backward
+ end
+
+ it "should log that it's reversing the change" do
+ @property.expects(:info)
+ @change.backward
+ end
+
+ it "should execute" do
+ @change.expects(:go)
+ @change.backward
+ end
+ end
end
end
end