diff options
author | Adam Jacob <adam@hjksolutions.com> | 2008-03-23 20:58:33 -0700 |
---|---|---|
committer | Adam Jacob <adam@hjksolutions.com> | 2008-03-23 20:58:33 -0700 |
commit | f543b509ba61dd347512e8a9e3153a49a2a8cb6b (patch) | |
tree | dc7275a6ee0c731391ef9ce46af5d3610f21ea9a /spec/unit | |
parent | c74068fffb387955cff8b32c2c984c782ee1e0a0 (diff) | |
download | chef-f543b509ba61dd347512e8a9e3153a49a2a8cb6b.tar.gz |
Bringing the file provider to 100 coverage
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/provider/file_spec.rb | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/spec/unit/provider/file_spec.rb b/spec/unit/provider/file_spec.rb index b31a4d7ef1..2ee6b1960e 100644 --- a/spec/unit/provider/file_spec.rb +++ b/spec/unit/provider/file_spec.rb @@ -127,6 +127,30 @@ describe Chef::Provider::File do end end + it "should compare the current group with the requested group" do + @provider.load_current_resource + @provider.new_resource.stub!(:group).and_return("adam") + Etc.stub!(:getgrnam).and_return( + OpenStruct.new( + :name => "adam", + :gid => 501 + ) + ) + @provider.current_resource.group(501) + @provider.compare_group.should eql(true) + + @provider.current_resource.group(777) + @provider.compare_group.should eql(false) + + @provider.new_resource.stub!(:group).and_return(501) + @provider.current_resource.group(501) + @provider.compare_group.should eql(true) + + @provider.new_resource.stub!(:group).and_return("501") + @provider.current_resource.group(501) + @provider.compare_group.should eql(true) + end + it "should set the group on the file to the requested group" do @provider.load_current_resource @provider.new_resource.stub!(:group).and_return(9982398) @@ -135,7 +159,7 @@ describe Chef::Provider::File do lambda { @provider.set_group }.should_not raise_error end - it "should raise an exception if you are not root and try to change ownership" do + it "should raise an exception if you are not root and try to change the group" do @provider.load_current_resource @provider.new_resource.stub!(:group).and_return(0) if Process.uid != 0 |