summaryrefslogtreecommitdiff
path: root/spec/unit/provider/group/gpasswd_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-10-24 18:12:50 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-10-24 18:12:50 -0700
commitbd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a (patch)
treeacc7a2d09b2cec8eed863218c0400cd15cd27854 /spec/unit/provider/group/gpasswd_spec.rb
parentbdce1c5619fde7d277262df9336e06f73e4fc3f8 (diff)
downloadchef-bd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a.tar.gz
updating resources/providers unit tests to rpsec3
mechanically generated patch using transpec 2.3.7 gem
Diffstat (limited to 'spec/unit/provider/group/gpasswd_spec.rb')
-rw-r--r--spec/unit/provider/group/gpasswd_spec.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/unit/provider/group/gpasswd_spec.rb b/spec/unit/provider/group/gpasswd_spec.rb
index 5bd7fdc569..55d978fa7e 100644
--- a/spec/unit/provider/group/gpasswd_spec.rb
+++ b/spec/unit/provider/group/gpasswd_spec.rb
@@ -41,14 +41,14 @@ 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
- File.stub(:exists?).and_return(true)
- File.should_receive(:exists?).with("/usr/bin/gpasswd").and_return(false)
- lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Group)
+ allow(File).to receive(:exists?).and_return(true)
+ expect(File).to receive(:exists?).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
- File.stub(:exists?).and_return(true)
- lambda { @provider.process_resource_requirements }.should_not raise_error
+ allow(File).to receive(:exists?).and_return(true)
+ expect { @provider.process_resource_requirements }.not_to raise_error
end
end
@@ -65,8 +65,8 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do
end
it "logs a message and sets group's members to 'none'" do
- Chef::Log.should_receive(:debug).with("group[wheel] setting group members to: none")
- @provider.should_receive(:shell_out!).with("gpasswd -M \"\" wheel")
+ expect(Chef::Log).to receive(:debug).with("group[wheel] setting group members to: none")
+ expect(@provider).to receive(:shell_out!).with("gpasswd -M \"\" wheel")
@provider.modify_group_members
end
end
@@ -78,20 +78,20 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do
end
it "does not modify group membership" do
- @provider.should_not_receive(:shell_out!)
+ expect(@provider).not_to receive(:shell_out!)
@provider.modify_group_members
end
end
describe "when the resource specifies group members" do
it "should log an appropriate debug message" do
- Chef::Log.should_receive(:debug).with("group[wheel] setting group members to: lobster, rage, fist")
- @provider.stub(:shell_out!)
+ expect(Chef::Log).to receive(:debug).with("group[wheel] setting group members to: lobster, rage, fist")
+ allow(@provider).to receive(:shell_out!)
@provider.modify_group_members
end
it "should run gpasswd with the members joined by ',' followed by the target group" do
- @provider.should_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)
- @provider.should_receive(:shell_out!).with("gpasswd -a lobster wheel")
- @provider.should_receive(:shell_out!).with("gpasswd -a rage wheel")
- @provider.should_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