summaryrefslogtreecommitdiff
path: root/spec/unit/provider/group/usermod_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-12-21 13:36:16 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-12-21 13:36:16 -0800
commitd5517ce1e766c096dde16e5c8a10732ee346c5dc (patch)
tree70d8ecf73c8b782cb09ef527c0ec66f1b3787ad1 /spec/unit/provider/group/usermod_spec.rb
parent81e4f3ee85fc4e9bef11c3468dcd1cb8d30f4cea (diff)
downloadchef-d5517ce1e766c096dde16e5c8a10732ee346c5dc.tar.gz
cleanup of group providerlcg/group-provider-cleanup
- consistent use of shell_out_compact! - remove more uses of run_command - some other code cleanup Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/provider/group/usermod_spec.rb')
-rw-r--r--spec/unit/provider/group/usermod_spec.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/unit/provider/group/usermod_spec.rb b/spec/unit/provider/group/usermod_spec.rb
index 7bd45c4f1b..c6422b12c9 100644
--- a/spec/unit/provider/group/usermod_spec.rb
+++ b/spec/unit/provider/group/usermod_spec.rb
@@ -46,18 +46,18 @@ describe Chef::Provider::Group::Usermod do
describe "with supplied members" do
platforms = {
- "openbsd" => "-G",
- "netbsd" => "-G",
- "solaris" => "-a -G",
- "suse" => "-a -G",
- "opensuse" => "-a -G",
- "smartos" => "-G",
- "omnios" => "-G",
+ "openbsd" => [ "-G" ],
+ "netbsd" => [ "-G" ],
+ "solaris" => [ "-a", "-G" ],
+ "suse" => [ "-a", "-G" ],
+ "opensuse" => [ "-a", "-G" ],
+ "smartos" => [ "-G" ],
+ "omnios" => [ "-G" ],
}
before do
allow(@new_resource).to receive(:members).and_return(%w{all your base})
- allow(File).to receive(:exists?).and_return(true)
+ allow(File).to receive(:exist?).and_return(true)
end
it "should raise an error when setting the entire group directly" do
@@ -85,9 +85,9 @@ describe Chef::Provider::Group::Usermod do
@provider.current_resource = current_resource
@node.automatic_attrs[:platform] = platform
allow(@new_resource).to receive(:append).and_return(true)
- expect(@provider).to receive(:shell_out!).with("usermod #{flags} wheel all")
- expect(@provider).to receive(:shell_out!).with("usermod #{flags} wheel your")
- expect(@provider).to receive(:shell_out!).with("usermod #{flags} wheel base")
+ expect(@provider).to receive(:shell_out!).with("usermod", *flags, "wheel", "all")
+ expect(@provider).to receive(:shell_out!).with("usermod", *flags, "wheel", "your")
+ expect(@provider).to receive(:shell_out!).with("usermod", *flags, "wheel", "base")
@provider.modify_group_members
end
end
@@ -96,19 +96,19 @@ describe Chef::Provider::Group::Usermod do
describe "when loading the current resource" do
before(:each) do
- allow(File).to receive(:exists?).and_return(false)
+ allow(File).to receive(:exist?).and_return(false)
@provider.action = :create
@provider.define_resource_requirements
end
it "should raise an error if the required binary /usr/sbin/usermod doesn't exist" do
- allow(File).to receive(:exists?).and_return(true)
- expect(File).to receive(:exists?).with("/usr/sbin/usermod").and_return(false)
+ allow(File).to receive(:exist?).and_return(true)
+ expect(File).to receive(:exist?).with("/usr/sbin/usermod").and_return(false)
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Group)
end
it "shouldn't raise an error if the required binaries exist" do
- allow(File).to receive(:exists?).and_return(true)
+ allow(File).to receive(:exist?).and_return(true)
expect { @provider.process_resource_requirements }.not_to raise_error
end
end