spec/unit/provider/augeas/augeas.rb in puppet-0.25.4 vs spec/unit/provider/augeas/augeas.rb in puppet-0.25.5
- old
+ new
@@ -139,10 +139,24 @@
args = [ "set", "/white\\ space/\\[section", "value" ]
tokens = @provider.parse_commands(args.join(" \t "))
tokens.should == [ args ]
end
+ it "should allow single quoted escaped spaces in paths" do
+ @resource.stubs(:[]).returns("/foo/")
+ args = [ "set", "'/white\\ space/key'", "value" ]
+ tokens = @provider.parse_commands(args.join(" \t "))
+ tokens.should == [[ "set", "/white\\ space/key", "value" ]]
+ end
+
+ it "should allow double quoted escaped spaces in paths" do
+ @resource.stubs(:[]).returns("/foo/")
+ args = [ "set", '"/white\\ space/key"', "value" ]
+ tokens = @provider.parse_commands(args.join(" \t "))
+ tokens.should == [[ "set", "/white\\ space/key", "value" ]]
+ end
+
it "should remove trailing slashes" do
@resource.stubs(:[]).returns("/foo/")
tokens = @provider.parse_commands("set foo/ bar")
tokens.should == [[ "set", "/foo/foo", "bar" ]]
end
@@ -202,10 +216,20 @@
it "should return false for includes non match" do
command = ["match", "fake value", "include JarJar"]
@provider.process_match(command).should == false
end
+ it "should return true for includes match" do
+ command = ["match", "fake value", "not_include JarJar"]
+ @provider.process_match(command).should == true
+ end
+
+ it "should return false for includes non match" do
+ command = ["match", "fake value", "not_include values"]
+ @provider.process_match(command).should == false
+ end
+
it "should return true for an array match" do
command = ["match", "fake value", "== ['set', 'of', 'values']"]
@provider.process_match(command).should == true
end
@@ -306,11 +330,11 @@
it "should handle set commands" do
command = "set JarJar Binks"
context = "/some/path/"
@resource.expects(:[]).times(2).returns(command).then.returns(context)
- @augeas.expects(:set).with("/some/path/JarJar", "Binks")
+ @augeas.expects(:set).with("/some/path/JarJar", "Binks").returns(true)
@augeas.expects(:save).returns(true)
@augeas.expects(:close)
@provider.execute_changes.should == :executed
end
@@ -336,11 +360,11 @@
it "should handle clear commands" do
command = "clear Jar/Jar"
context = "/foo/"
@resource.expects(:[]).times(2).returns(command).then.returns(context)
- @augeas.expects(:clear).with("/foo/Jar/Jar")
+ @augeas.expects(:clear).with("/foo/Jar/Jar").returns(true)
@augeas.expects(:save).returns(true)
@augeas.expects(:close)
@provider.execute_changes.should == :executed
end
@@ -378,10 +402,10 @@
it "should handle multiple commands" do
command = ["ins Binks after /Jar/Jar", "clear Jar/Jar"]
context = "/foo/"
@resource.expects(:[]).times(2).returns(command).then.returns(context)
@augeas.expects(:insert).with("/Jar/Jar", "Binks", false)
- @augeas.expects(:clear).with("/foo/Jar/Jar")
+ @augeas.expects(:clear).with("/foo/Jar/Jar").returns(true)
@augeas.expects(:save).returns(true)
@augeas.expects(:close)
@provider.execute_changes.should == :executed
end
end