diff options
author | Christopher M. Luciano <cmluciano@us.ibm.com> | 2015-10-12 18:19:57 -0400 |
---|---|---|
committer | Christopher M. Luciano <cmluciano@us.ibm.com> | 2015-10-12 18:19:57 -0400 |
commit | 5b2326a93c1c926ee0c302f57e46edabf8638fc7 (patch) | |
tree | c6bb5276f2b3f14060cb58351d23922faa549765 /spec | |
parent | 841b973d59382192058d05f7a5d46c8e1ea1a875 (diff) | |
download | chef-5b2326a93c1c926ee0c302f57e46edabf8638fc7.tar.gz |
Add recommended test from btm
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/user_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/unit/provider/user_spec.rb b/spec/unit/provider/user_spec.rb index 381168647b..39d8838944 100644 --- a/spec/unit/provider/user_spec.rb +++ b/spec/unit/provider/user_spec.rb @@ -452,11 +452,20 @@ describe Chef::Provider::User do it "should raise an error if we can't translate the group name during resource assertions" do expect(Etc).to receive(:getgrnam).and_raise(ArgumentError) + @provider.action = :create @provider.define_resource_requirements @provider.convert_group_name expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::User) end + it "does not raise an error if we can't translate the group name during resource assertions if we are removing the user" do + expect(Etc).to receive(:getgrnam).and_raise(ArgumentError) + @provider.action = :remove + @provider.define_resource_requirements + @provider.convert_group_name + expect { @provider.process_resource_requirements }.not_to raise_error + end + it "should set the new resources gid to the integerized version if available" do expect(Etc).to receive(:getgrnam).with("999").and_return(@group) @provider.convert_group_name |