summaryrefslogtreecommitdiff
path: root/spec/unit/provider/group
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-01-29 14:17:47 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2014-01-29 14:17:47 -0800
commitb19b7d000887209f9d8dc1dc6aa468a0497a7391 (patch)
tree68d1eb6c136df20c2800f1dddb4e2c1ed5d75a42 /spec/unit/provider/group
parentb5c9c6afdfd83fe3f1bf4c991daffeff94b49750 (diff)
downloadchef-b19b7d000887209f9d8dc1dc6aa468a0497a7391.tar.gz
s/stub!/stub/g
fix deprecation warnings
Diffstat (limited to 'spec/unit/provider/group')
-rw-r--r--spec/unit/provider/group/dscl_spec.rb24
-rw-r--r--spec/unit/provider/group/gpasswd_spec.rb8
-rw-r--r--spec/unit/provider/group/groupadd_spec.rb20
-rw-r--r--spec/unit/provider/group/groupmod_spec.rb4
-rw-r--r--spec/unit/provider/group/pw_spec.rb14
-rw-r--r--spec/unit/provider/group/usermod_spec.rb22
-rw-r--r--spec/unit/provider/group/windows_spec.rb16
7 files changed, 54 insertions, 54 deletions
diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb
index 360a799b5f..5890ee43a1 100644
--- a/spec/unit/provider/group/dscl_spec.rb
+++ b/spec/unit/provider/group/dscl_spec.rb
@@ -32,7 +32,7 @@ describe Chef::Provider::Group::Dscl do
@stdin = StringIO.new
@stdout = StringIO.new("\n")
@stderr = StringIO.new("")
- @provider.stub!(:popen4).and_yield(@pid,@stdin,@stdout,@stderr).and_return(@status)
+ @provider.stub(:popen4).and_yield(@pid,@stdin,@stdout,@stderr).and_return(@status)
end
it "should run popen4 with the supplied array of arguments appended to the dscl command" do
@@ -50,7 +50,7 @@ describe Chef::Provider::Group::Dscl do
before do
@node = Chef::Node.new
@provider = Chef::Provider::Group::Dscl.new(@node, @new_resource)
- @provider.stub!(:dscl).and_return(["cmd", @status, "stdout", "stderr"])
+ @provider.stub(:dscl).and_return(["cmd", @status, "stdout", "stderr"])
end
it "should run dscl with the supplied cmd /Path args" do
@@ -61,7 +61,7 @@ describe Chef::Provider::Group::Dscl do
describe "with the dscl command returning a non zero exit status for a delete" do
before do
@status = mock("Process::Status", :exitstatus => 1)
- @provider.stub!(:dscl).and_return(["cmd", @status, "stdout", "stderr"])
+ @provider.stub(:dscl).and_return(["cmd", @status, "stdout", "stderr"])
end
it "should return an empty string of standard output for a delete" do
@@ -77,7 +77,7 @@ describe Chef::Provider::Group::Dscl do
describe "with the dscl command returning no such key" do
before do
- @provider.stub!(:dscl).and_return(["cmd", @status, "No such key: ", "stderr"])
+ @provider.stub(:dscl).and_return(["cmd", @status, "No such key: ", "stderr"])
end
it "should raise an exception" do
@@ -98,7 +98,7 @@ describe Chef::Provider::Group::Dscl do
before do
@node = Chef::Node.new
@provider = Chef::Provider::Group::Dscl.new(@node, @new_resource)
- @provider.stub!(:safe_dscl).and_return("\naj 200\njt 201\n")
+ @provider.stub(:safe_dscl).and_return("\naj 200\njt 201\n")
end
it "should run safe_dscl with list /Groups gid" do
@@ -120,7 +120,7 @@ describe Chef::Provider::Group::Dscl do
before do
@node = Chef::Node.new
@provider = Chef::Provider::Group::Dscl.new(@node, @new_resource)
- @provider.stub!(:safe_dscl).and_return("\naj 500\n")
+ @provider.stub(:safe_dscl).and_return("\naj 500\n")
end
it "should run safe_dscl with list /Groups gid" do
@@ -144,7 +144,7 @@ describe Chef::Provider::Group::Dscl do
describe "set_gid" do
describe "with the new resource and a gid number which is already in use" do
before do
- @provider.stub!(:gid_used?).and_return(true)
+ @provider.stub(:gid_used?).and_return(true)
end
it "should raise an exception if the new resources gid is already in use" do
@@ -162,7 +162,7 @@ describe Chef::Provider::Group::Dscl do
describe "with blank gid number for the new resources" do
before do
@new_resource.instance_variable_set(:@gid, nil)
- @new_resource.stub!(:safe_dscl)
+ @new_resource.stub(:safe_dscl)
end
it "should run get_free_gid and return a valid, unused gid number" do
@@ -185,9 +185,9 @@ describe Chef::Provider::Group::Dscl do
describe "with existing members in the current resource and append set to false in the new resource" do
before do
- @new_resource.stub!(:members).and_return([])
- @new_resource.stub!(:append).and_return(false)
- @current_resource.stub!(:members).and_return(["all", "your", "base"])
+ @new_resource.stub(:members).and_return([])
+ @new_resource.stub(:append).and_return(false)
+ @current_resource.stub(:members).and_return(["all", "your", "base"])
end
it "should log an appropriate message" do
@@ -246,7 +246,7 @@ describe Chef::Provider::Group::Dscl do
end
it "doesn't raise an error if /usr/bin/dscl exists" do
- File.stub!(:exists?).and_return(true)
+ File.stub(:exists?).and_return(true)
lambda { @provider.process_resource_requirements }.should_not raise_error(Chef::Exceptions::Group)
end
end
diff --git a/spec/unit/provider/group/gpasswd_spec.rb b/spec/unit/provider/group/gpasswd_spec.rb
index f765667300..0436812501 100644
--- a/spec/unit/provider/group/gpasswd_spec.rb
+++ b/spec/unit/provider/group/gpasswd_spec.rb
@@ -27,7 +27,7 @@ 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
@@ -40,13 +40,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
- File.stub!(:exists?).and_return(true)
+ 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)
end
it "shouldn't raise an error if the required binaries exist" do
- File.stub!(:exists?).and_return(true)
+ File.stub(:exists?).and_return(true)
lambda { @provider.process_resource_requirements }.should_not raise_error(Chef::Exceptions::Group)
end
end
@@ -85,7 +85,7 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do
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!)
+ @provider.stub(:shell_out!)
@provider.modify_group_members
end
diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb
index 91073727c8..793615d04c 100644
--- a/spec/unit/provider/group/groupadd_spec.rb
+++ b/spec/unit/provider/group/groupadd_spec.rb
@@ -48,7 +48,7 @@ describe Chef::Provider::Group::Groupadd, "set_options" do
@provider.set_options
end
it "should set the option for #{attribute} if the new resources #{attribute} is not null" do
- @new_resource.stub!(attribute).and_return("wowaweea")
+ @new_resource.stub(attribute).and_return("wowaweea")
@provider.set_options.should eql(" #{option} '#{@new_resource.send(attribute)}' #{@new_resource.group_name}")
end
end
@@ -56,7 +56,7 @@ describe Chef::Provider::Group::Groupadd, "set_options" do
it "should combine all the possible options" do
match_string = ""
field_list.sort{ |a,b| a[0] <=> b[0] }.each do |attribute, option|
- @new_resource.stub!(attribute).and_return("hola")
+ @new_resource.stub(attribute).and_return("hola")
match_string << " #{option} 'hola'"
end
match_string << " aj"
@@ -93,10 +93,10 @@ describe Chef::Provider::Group::Groupadd, "create_group" do
@node = Chef::Node.new
@new_resource = Chef::Resource::Group.new("aj")
@provider = Chef::Provider::Group::Groupadd.new(@node, @new_resource)
- @provider.stub!(:run_command).and_return(true)
- @provider.stub!(:set_options).and_return(" monkey")
- @provider.stub!(:groupadd_options).and_return("")
- @provider.stub!(:modify_group_members).and_return(true)
+ @provider.stub(:run_command).and_return(true)
+ @provider.stub(:set_options).and_return(" monkey")
+ @provider.stub(:groupadd_options).and_return("")
+ @provider.stub(:modify_group_members).and_return(true)
end
it "should run groupadd with the return of set_options" do
@@ -117,14 +117,14 @@ describe Chef::Provider::Group::Groupadd do
@run_context = Chef::RunContext.new(@node, {}, @events)
@new_resource = Chef::Resource::Group.new("aj")
@provider = Chef::Provider::Group::Groupadd.new(@new_resource, @run_context)
- @provider.stub!(:run_command).and_return(true)
- @provider.stub!(:set_options).and_return(" monkey")
+ @provider.stub(:run_command).and_return(true)
+ @provider.stub(:set_options).and_return(" monkey")
end
describe "manage group" do
it "should run groupmod with the return of set_options" do
- @provider.stub!(:modify_group_members).and_return(true)
+ @provider.stub(:modify_group_members).and_return(true)
@provider.should_receive(:run_command).with({ :command => "groupmod monkey" }).and_return(true)
@provider.manage_group
end
@@ -151,7 +151,7 @@ describe Chef::Provider::Group::Groupadd do
describe "load_current_resource" do
before do
- File.stub!(:exists?).and_return(false)
+ File.stub(:exists?).and_return(false)
@provider.define_resource_requirements
end
it "should raise an error if the required binary /usr/sbin/groupadd doesn't exist" do
diff --git a/spec/unit/provider/group/groupmod_spec.rb b/spec/unit/provider/group/groupmod_spec.rb
index bfacfa5c26..3d49f667d4 100644
--- a/spec/unit/provider/group/groupmod_spec.rb
+++ b/spec/unit/provider/group/groupmod_spec.rb
@@ -43,7 +43,7 @@ describe Chef::Provider::Group::Groupmod do
end
it "shouldn't raise an error if the required binaries exist" do
- File.stub!(:exists?).and_return(true)
+ File.stub(:exists?).and_return(true)
lambda { @provider.load_current_resource }.should_not raise_error(Chef::Exceptions::Group)
end
end
@@ -89,7 +89,7 @@ describe Chef::Provider::Group::Groupmod do
end
it "updates group membership correctly" do
- Chef::Log.stub!(:debug)
+ Chef::Log.stub(:debug)
@provider.should_receive(:shell_out!).with("group mod -n wheel_bak wheel")
@provider.should_receive(:shell_out!).with("user mod -G wheel lobster")
@provider.should_receive(:shell_out!).with("group add -g '123' -o wheel")
diff --git a/spec/unit/provider/group/pw_spec.rb b/spec/unit/provider/group/pw_spec.rb
index a545f8ee70..103bc33bd4 100644
--- a/spec/unit/provider/group/pw_spec.rb
+++ b/spec/unit/provider/group/pw_spec.rb
@@ -77,8 +77,8 @@ describe Chef::Provider::Group::Pw do
describe "with an empty members array in both the new and current resource" do
before do
- @new_resource.stub!(:members).and_return([])
- @current_resource.stub!(:members).and_return([])
+ @new_resource.stub(:members).and_return([])
+ @current_resource.stub(:members).and_return([])
end
it "should set no options" do
@@ -88,8 +88,8 @@ describe Chef::Provider::Group::Pw do
describe "with an empty members array in the new resource and existing members in the current resource" do
before do
- @new_resource.stub!(:members).and_return([])
- @current_resource.stub!(:members).and_return(["all", "your", "base"])
+ @new_resource.stub(:members).and_return([])
+ @current_resource.stub(:members).and_return(["all", "your", "base"])
end
it "should log an appropriate message" do
@@ -104,8 +104,8 @@ describe Chef::Provider::Group::Pw do
describe "with supplied members array in the new resource and an empty members array in the current resource" do
before do
- @new_resource.stub!(:members).and_return(["all", "your", "base"])
- @current_resource.stub!(:members).and_return([])
+ @new_resource.stub(:members).and_return(["all", "your", "base"])
+ @current_resource.stub(:members).and_return([])
end
it "should log an appropriate debug message" do
@@ -130,7 +130,7 @@ describe Chef::Provider::Group::Pw do
end
it "shouldn't raise an error if /usr/sbin/pw exists" do
- File.stub!(:exists?).and_return(true)
+ File.stub(:exists?).and_return(true)
lambda { @provider.process_resource_requirements }.should_not raise_error(Chef::Exceptions::Group)
end
end
diff --git a/spec/unit/provider/group/usermod_spec.rb b/spec/unit/provider/group/usermod_spec.rb
index 1687cc0b65..cc3a28fb74 100644
--- a/spec/unit/provider/group/usermod_spec.rb
+++ b/spec/unit/provider/group/usermod_spec.rb
@@ -27,15 +27,15 @@ describe Chef::Provider::Group::Usermod do
@new_resource.members [ "all", "your", "base" ]
@new_resource.excluded_members [ ]
@provider = Chef::Provider::Group::Usermod.new(@new_resource, @run_context)
- @provider.stub!(:run_command)
+ @provider.stub(:run_command)
end
describe "modify_group_members" do
describe "with an empty members array" do
before do
- @new_resource.stub!(:append).and_return(true)
- @new_resource.stub!(:members).and_return([])
+ @new_resource.stub(:append).and_return(true)
+ @new_resource.stub(:members).and_return([])
end
it "should log an appropriate message" do
@@ -55,8 +55,8 @@ describe Chef::Provider::Group::Usermod do
}
before do
- @new_resource.stub!(:members).and_return(["all", "your", "base"])
- File.stub!(:exists?).and_return(true)
+ @new_resource.stub(:members).and_return(["all", "your", "base"])
+ File.stub(:exists?).and_return(true)
end
it "should raise an error when setting the entire group directly" do
@@ -72,8 +72,8 @@ describe Chef::Provider::Group::Usermod do
@provider.load_current_resource
@provider.instance_variable_set("@group_exists", true)
@provider.action = :modify
- @new_resource.stub!(:append).and_return(true)
- @new_resource.stub!(:excluded_members).and_return(["someone"])
+ @new_resource.stub(:append).and_return(true)
+ @new_resource.stub(:excluded_members).and_return(["someone"])
lambda { @provider.run_action(@provider.process_resource_requirements) }.should raise_error(Chef::Exceptions::Group, "excluded_members is not supported by #{@provider.to_s}")
end
@@ -83,7 +83,7 @@ describe Chef::Provider::Group::Usermod do
current_resource.members([ ])
@provider.current_resource = current_resource
@node.automatic_attrs[:platform] = platform
- @new_resource.stub!(:append).and_return(true)
+ @new_resource.stub(:append).and_return(true)
@provider.should_receive(:shell_out!).with("usermod #{flags} wheel all")
@provider.should_receive(:shell_out!).with("usermod #{flags} wheel your")
@provider.should_receive(:shell_out!).with("usermod #{flags} wheel base")
@@ -95,18 +95,18 @@ describe Chef::Provider::Group::Usermod do
describe "when loading the current resource" do
before(:each) do
- File.stub!(:exists?).and_return(false)
+ File.stub(:exists?).and_return(false)
@provider.define_resource_requirements
end
it "should raise an error if the required binary /usr/sbin/usermod doesn't exist" do
- File.stub!(:exists?).and_return(true)
+ File.stub(:exists?).and_return(true)
File.should_receive(:exists?).with("/usr/sbin/usermod").and_return(false)
lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Group)
end
it "shouldn't raise an error if the required binaries exist" do
- File.stub!(:exists?).and_return(true)
+ File.stub(:exists?).and_return(true)
lambda { @provider.process_resource_requirements }.should_not raise_error(Chef::Exceptions::Group)
end
end
diff --git a/spec/unit/provider/group/windows_spec.rb b/spec/unit/provider/group/windows_spec.rb
index e8c1243ce5..b395ed96d8 100644
--- a/spec/unit/provider/group/windows_spec.rb
+++ b/spec/unit/provider/group/windows_spec.rb
@@ -34,7 +34,7 @@ describe Chef::Provider::Group::Windows do
@run_context = Chef::RunContext.new(@node, {}, @events)
@new_resource = Chef::Resource::Group.new("staff")
@net_group = mock("Chef::Util::Windows::NetGroup")
- Chef::Util::Windows::NetGroup.stub!(:new).and_return(@net_group)
+ Chef::Util::Windows::NetGroup.stub(:new).and_return(@net_group)
@provider = Chef::Provider::Group::Windows.new(@new_resource, @run_context)
end
@@ -52,21 +52,21 @@ describe Chef::Provider::Group::Windows do
@current_resource = Chef::Resource::Group.new("staff")
@current_resource.members [ "all", "your", "base" ]
- Chef::Util::Windows::NetGroup.stub!(:new).and_return(@net_group)
- @net_group.stub!(:local_add_members)
- @net_group.stub!(:local_set_members)
+ Chef::Util::Windows::NetGroup.stub(:new).and_return(@net_group)
+ @net_group.stub(:local_add_members)
+ @net_group.stub(:local_set_members)
@provider.stub(:local_group_name_to_sid)
@provider.current_resource = @current_resource
end
it "should call @net_group.local_set_members" do
- @new_resource.stub!(:append).and_return(false)
+ @new_resource.stub(:append).and_return(false)
@net_group.should_receive(:local_set_members).with(@new_resource.members)
@provider.manage_group
end
it "should call @net_group.local_add_members" do
- @new_resource.stub!(:append).and_return(true)
+ @new_resource.stub(:append).and_return(true)
@net_group.should_receive(:local_add_members).with(@new_resource.members)
@provider.manage_group
end
@@ -75,8 +75,8 @@ describe Chef::Provider::Group::Windows do
describe "remove_group" do
before do
- Chef::Util::Windows::NetGroup.stub!(:new).and_return(@net_group)
- @provider.stub!(:run_command).and_return(true)
+ Chef::Util::Windows::NetGroup.stub(:new).and_return(@net_group)
+ @provider.stub(:run_command).and_return(true)
end
it "should call @net_group.local_delete" do