diff options
Diffstat (limited to 'spec/unit/provider/group/gpasswd_spec.rb')
-rw-r--r-- | spec/unit/provider/group/gpasswd_spec.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/unit/provider/group/gpasswd_spec.rb b/spec/unit/provider/group/gpasswd_spec.rb index 16e6ad15ea..add87bf008 100644 --- a/spec/unit/provider/group/gpasswd_spec.rb +++ b/spec/unit/provider/group/gpasswd_spec.rb @@ -27,11 +27,11 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do @new_resource.members %w{lobster rage fist} @new_resource.append false @provider = Chef::Provider::Group::Gpasswd.new(@new_resource, @run_context) - #@provider.stub(:run_command).and_return(true) + # @provider.stub(:run_command).and_return(true) end describe "when determining the current group state" do - before (:each) do + before(:each) do @provider.action = :create @provider.load_current_resource @provider.define_resource_requirements @@ -41,13 +41,13 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do # for Chef::Provider::Group - no need to repeat it here. We'll # include only what's specific to this provider. it "should raise an error if the required binary /usr/bin/gpasswd doesn't exist" do - allow(File).to receive(:exists?).and_return(true) - expect(File).to receive(:exists?).with("/usr/bin/gpasswd").and_return(false) + allow(File).to receive(:exist?).and_return(true) + expect(File).to receive(:exist?).with("/usr/bin/gpasswd").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 @@ -66,7 +66,7 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do it "logs a message and sets group's members to 'none'" do expect(Chef::Log).to receive(:debug).with("group[wheel] setting group members to: none") - expect(@provider).to receive(:shell_out!).with("gpasswd -M \"\" wheel") + expect(@provider).to receive(:shell_out!).with("gpasswd", "-M", "", "wheel") @provider.modify_group_members end end @@ -91,7 +91,7 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do end it "should run gpasswd with the members joined by ',' followed by the target group" do - expect(@provider).to receive(:shell_out!).with("gpasswd -M lobster,rage,fist wheel") + expect(@provider).to receive(:shell_out!).with("gpasswd", "-M", "lobster,rage,fist", "wheel") @provider.modify_group_members end @@ -104,9 +104,9 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do it "should run gpasswd individually for each user when the append option is set" do @new_resource.append(true) - expect(@provider).to receive(:shell_out!).with("gpasswd -a lobster wheel") - expect(@provider).to receive(:shell_out!).with("gpasswd -a rage wheel") - expect(@provider).to receive(:shell_out!).with("gpasswd -a fist wheel") + expect(@provider).to receive(:shell_out!).with("gpasswd", "-a", "lobster", "wheel") + expect(@provider).to receive(:shell_out!).with("gpasswd", "-a", "rage", "wheel") + expect(@provider).to receive(:shell_out!).with("gpasswd", "-a", "fist", "wheel") @provider.modify_group_members end end |