diff options
Diffstat (limited to 'spec/unit/provider/group/dscl_spec.rb')
-rw-r--r-- | spec/unit/provider/group/dscl_spec.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb index b526848dfd..28d78cbdbd 100644 --- a/spec/unit/provider/group/dscl_spec.rb +++ b/spec/unit/provider/group/dscl_spec.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,14 +27,14 @@ describe Chef::Provider::Group::Dscl do @current_resource = Chef::Resource::Group.new("aj") @provider = Chef::Provider::Group::Dscl.new(@new_resource, @run_context) @provider.current_resource = @current_resource - @status = mock("Process::Status", :exitstatus => 0) + @status = mock("Process::Status", :exitstatus => 0) @pid = 2342 @stdin = StringIO.new @stdout = StringIO.new("\n") @stderr = StringIO.new("") @provider.stub!(:popen4).and_yield(@pid,@stdin,@stdout,@stderr).and_return(@status) end - + it "should run popen4 with the supplied array of arguments appended to the dscl command" do @provider.should_receive(:popen4).with("dscl . -cmd /Path arg1 arg2") @provider.dscl("cmd", "/Path", "arg1", "arg2") @@ -52,7 +52,7 @@ describe Chef::Provider::Group::Dscl do @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) @provider.stub!(:dscl).and_return(["cmd", @status, "stdout", "stderr"]) end - + it "should run dscl with the supplied cmd /Path args" do @provider.should_receive(:dscl).with("cmd /Path args") @provider.safe_dscl("cmd /Path args") @@ -84,7 +84,7 @@ describe Chef::Provider::Group::Dscl do lambda { @provider.safe_dscl("cmd /Path arguments") }.should raise_error(Chef::Exceptions::Group) end end - + describe "with the dscl command returning a zero exit status" do it "should return the third array element, the string of standard output" do safe_dscl_retval = @provider.safe_dscl("cmd /Path args") @@ -100,7 +100,7 @@ describe Chef::Provider::Group::Dscl do @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) @provider.stub!(:safe_dscl).and_return("\naj 200\njt 201\n") end - + it "should run safe_dscl with list /Groups gid" do @provider.should_receive(:safe_dscl).with("list /Groups gid") @provider.get_free_gid @@ -109,7 +109,7 @@ describe Chef::Provider::Group::Dscl do it "should return the first unused gid number on or above 200" do @provider.get_free_gid.should equal(202) end - + it "should raise an exception when the search limit is exhausted" do search_limit = 1 lambda { @provider.get_free_gid(search_limit) }.should raise_error(RuntimeError) @@ -127,7 +127,7 @@ describe Chef::Provider::Group::Dscl do @provider.should_receive(:safe_dscl).with("list /Groups gid") @provider.gid_used?(500) end - + it "should return true for a used gid number" do @provider.gid_used?(500).should be_true end @@ -151,7 +151,7 @@ describe Chef::Provider::Group::Dscl do lambda { @provider.set_gid }.should raise_error(Chef::Exceptions::Group) end end - + describe "with no gid number for the new resources" do it "should run get_free_gid and return a valid, unused gid number" do @provider.should_receive(:get_free_gid).and_return(501) @@ -220,7 +220,7 @@ describe Chef::Provider::Group::Dscl do @provider.set_members end end - + describe "with no members in the new resource" do before do @new_resource.append(true) @@ -276,7 +276,7 @@ describe Chef::Provider::Group::Dscl do @provider.should_receive(:set_gid) @provider.manage_group end - + it "should manage the members if it changed and the new resources members is not null" do @current_resource.members(%{charlie root}) @new_resource.members(%{crab revenge}) |