diff options
| author | Dominic Cleal <dcleal@redhat.com> | 2011-08-06 17:46:20 +0100 |
|---|---|---|
| committer | Dominic Cleal <dcleal@redhat.com> | 2011-08-06 17:50:22 +0100 |
| commit | 344aef91a3589ce3fcc4dfb00df16762ceef81d5 (patch) | |
| tree | 3180ae9aef512bcb96b7cc66cf69cc1fb4dc2807 /spec/unit | |
| parent | 2185bb2804aeef6b419667951b2157b01404c694 (diff) | |
| download | puppet-344aef91a3589ce3fcc4dfb00df16762ceef81d5.tar.gz puppet-344aef91a3589ce3fcc4dfb00df16762ceef81d5.tar.xz puppet-344aef91a3589ce3fcc4dfb00df16762ceef81d5.zip | |
(#8808) Fail Augeas resource when unable to save changes
Raise a failure when Augeas changes cannot be saved (due to invalid layout of
the tree, permissions etc). Fixes a regression.
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/provider/augeas/augeas_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 434a99d70..874f70a8d 100755 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -442,6 +442,20 @@ describe provider_class do @provider.expects(:diff).with("#{file}", "#{file}.augnew").returns("") @provider.should be_need_to_run end + + it "should fail with an error if saving fails" do + file = "/etc/hosts" + + @resource[:context] = "/files" + @resource[:changes] = ["set #{file}/foo bar"] + + @augeas_stub.stubs(:save).returns(false) + @augeas_stub.stubs(:match).with("/augeas/events/saved").returns([]) + @augeas_stub.expects(:close) + + @provider.expects(:diff).never() + lambda { @provider.need_to_run? }.should raise_error + end end end |
