Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created September 5, 2012 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domcleal/3636382 to your computer and use it in GitHub Desktop.
Save domcleal/3636382 to your computer and use it in GitHub Desktop.
rspec examples for puppet PR #1067
it "should handle clearm commands" do
@resource[:changes] = ["set test[1]/Jar/Jar Foo","set test[2]/Jar/Jar Bar","clearm test Jar/Jar"]
@resource[:context] = "/foo/"
@augeas.expects(:respond_to?).with("clearm").returns(true)
@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(:clearm).with("/foo/test", "Jar/Jar").returns(true)
@augeas.expects(:save).returns(true)
@augeas.expects(:close)
@provider.execute_changes.should == :executed
end
it "should throw error if clearm command not supported" do
@resource[:changes] = ["set test[1]/Jar/Jar Foo","set test[2]/Jar/Jar Bar","clearm test Jar/Jar"]
@resource[:context] = "/foo/"
@augeas.expects(:respond_to?).with("clearm").returns(false)
@augeas.expects(:set).with("/foo/test[1]/Jar/Jar", "Foo").returns(true)
@augeas.expects(:set).with("/foo/test[2]/Jar/Jar", "Bar").returns(true)
lambda { @provider.execute_changes }.should raise_error
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment