diff options
| author | Daniel Pittman <daniel@rimspace.net> | 2011-08-12 06:23:00 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@rimspace.net> | 2011-08-12 06:23:00 -0700 |
| commit | 1ce2973e8af2300aff2b042257d8181855cf887d (patch) | |
| tree | 86953fd295ada5664bf2243e15bf1fc928fb8330 /spec/unit | |
| parent | fa1ec4dd93f015c2943271c9ae107991c6d3c90e (diff) | |
| parent | 344aef91a3589ce3fcc4dfb00df16762ceef81d5 (diff) | |
| download | puppet-1ce2973e8af2300aff2b042257d8181855cf887d.tar.gz puppet-1ce2973e8af2300aff2b042257d8181855cf887d.tar.xz puppet-1ce2973e8af2300aff2b042257d8181855cf887d.zip | |
Merge pull request #22 from domcleal/tickets/2.7.x/8808
(#8808) Fail Augeas resource when unable to save changes
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 |
