diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2011-03-29 16:30:27 -0700 |
|---|---|---|
| committer | Jesse Wolfe <jes5199@gmail.com> | 2011-03-29 16:30:27 -0700 |
| commit | 9290b2f990fd4b267b2eb0da719b8f320484c4d7 (patch) | |
| tree | e028dfab8ad5708f6754904d0e97fb27c2872031 /spec | |
| parent | 12f5a15305ce7dc86dbd21f4f77162cae637cbfd (diff) | |
| parent | f0d768465d011e01a4ce247130e3f139a23b4c54 (diff) | |
| download | puppet-9290b2f990fd4b267b2eb0da719b8f320484c4d7.tar.gz puppet-9290b2f990fd4b267b2eb0da719b8f320484c4d7.tar.xz puppet-9290b2f990fd4b267b2eb0da719b8f320484c4d7.zip | |
Merge branch 'tickets/master/6494' of https://github.com/domcleal/puppet into next
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/unit/provider/augeas/augeas_spec.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 9fcc85660..c65f39097 100644 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -433,5 +433,59 @@ describe provider_class do @augeas.expects(:close) @provider.execute_changes.should == :executed end + + it "should handle defvar commands" do + command = "defvar myjar Jar/Jar" + context = "/foo/" + @resource.expects(:[]).times(2).returns(command).then.returns(context) + @augeas.expects(:defvar).with("myjar", "/foo/Jar/Jar").returns(true) + @augeas.expects(:save).returns(true) + @augeas.expects(:close) + @provider.execute_changes.should == :executed + end + + it "should pass through augeas variables without context" do + command = ["defvar myjar Jar/Jar","set $myjar/Binks 1"] + context = "/foo/" + @resource.expects(:[]).times(2).returns(command).then.returns(context) + @augeas.expects(:defvar).with("myjar", "/foo/Jar/Jar").returns(true) + # this is the important bit, shouldn't be /foo/$myjar/Binks + @augeas.expects(:set).with("$myjar/Binks", "1").returns(true) + @augeas.expects(:save).returns(true) + @augeas.expects(:close) + @provider.execute_changes.should == :executed + end + + it "should handle defnode commands" do + command = "defnode newjar Jar/Jar[last()+1] Binks" + context = "/foo/" + @resource.expects(:[]).times(2).returns(command).then.returns(context) + @augeas.expects(:defnode).with("newjar", "/foo/Jar/Jar[last()+1]", "Binks").returns(true) + @augeas.expects(:save).returns(true) + @augeas.expects(:close) + @provider.execute_changes.should == :executed + end + + it "should handle mv commands" do + command = "mv Jar/Jar Binks" + context = "/foo/" + @resource.expects(:[]).times(2).returns(command).then.returns(context) + @augeas.expects(:mv).with("/foo/Jar/Jar", "/foo/Binks").returns(true) + @augeas.expects(:save).returns(true) + @augeas.expects(:close) + @provider.execute_changes.should == :executed + end + + it "should handle setm commands" do + command = ["set test[1]/Jar/Jar Foo","set test[2]/Jar/Jar Bar","setm test Jar/Jar Binks"] + context = "/foo/" + @resource.expects(:[]).times(2).returns(command).then.returns(context) + @augeas.expects(:set).with("/foo/test[1]/Jar/Jar", "Foo").returns(true) + @augeas.expects(:set).with("/foo/test[2]/Jar/Jar", "Bar").returns(true) + @augeas.expects(:setm).with("/foo/test", "Jar/Jar", "Binks").returns(true) + @augeas.expects(:save).returns(true) + @augeas.expects(:close) + @provider.execute_changes.should == :executed + end end end |
