diff options
Diffstat (limited to 'spec/unit/provider/group_spec.rb')
-rw-r--r-- | spec/unit/provider/group_spec.rb | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb index a076593511..ad6cfbff7c 100644 --- a/spec/unit/provider/group_spec.rb +++ b/spec/unit/provider/group_spec.rb @@ -41,7 +41,7 @@ describe Chef::Provider::User do :gid => 20, :mem => [ "root", "aj" ] ) - Etc.stub!(:getgrnam).with('wheel').and_return(@pw_group) + Etc.stub(:getgrnam).with('wheel').and_return(@pw_group) end it "assumes the group exists by default" do @@ -74,7 +74,7 @@ describe Chef::Provider::User do end it "should flip the value of exists if it cannot be found in /etc/group" do - Etc.stub!(:getgrnam).and_raise(ArgumentError) + Etc.stub(:getgrnam).and_raise(ArgumentError) @provider.load_current_resource @provider.group_exists.should be_false end @@ -87,7 +87,7 @@ describe Chef::Provider::User do describe "when determining if the system is already in the target state" do [ :gid, :members ].each do |attribute| it "should return true if #{attribute} doesn't match" do - @current_resource.stub!(attribute).and_return("looooooooooooooooooool") + @current_resource.stub(attribute).and_return("looooooooooooooooooool") @provider.compare_group.should be_true end end @@ -98,26 +98,26 @@ describe Chef::Provider::User do it "should return false if append is true and the group member(s) already exists" do @current_resource.members << "extra_user" - @new_resource.stub!(:append).and_return(true) + @new_resource.stub(:append).and_return(true) @provider.compare_group.should be_false end it "should return true if append is true and the group member(s) do not already exist" do @new_resource.members << "extra_user" - @new_resource.stub!(:append).and_return(true) + @new_resource.stub(:append).and_return(true) @provider.compare_group.should be_true end it "should return false if append is true and excluded_members include a non existing member" do @new_resource.excluded_members << "extra_user" - @new_resource.stub!(:append).and_return(true) + @new_resource.stub(:append).and_return(true) @provider.compare_group.should be_false end it "should return true if the append is true and excluded_members include an existing user" do @new_resource.members.each {|m| @new_resource.excluded_members << m } @new_resource.members.clear - @new_resource.stub!(:append).and_return(true) + @new_resource.stub(:append).and_return(true) @provider.compare_group.should be_true end @@ -132,32 +132,32 @@ describe Chef::Provider::User do it "should set the new_resources updated flag when it creates the group" do @provider.group_exists = false - @provider.stub!(:create_group) + @provider.stub(:create_group) @provider.run_action(:create) @provider.new_resource.should be_updated end it "should check to see if the group has mismatched attributes if the group exists" do @provider.group_exists = true - @provider.stub!(:compare_group).and_return(false) - @provider.stub!(:change_desc).and_return([ ]) + @provider.stub(:compare_group).and_return(false) + @provider.stub(:change_desc).and_return([ ]) @provider.run_action(:create) @provider.new_resource.should_not be_updated end it "should call manage_group if the group exists and has mismatched attributes" do @provider.group_exists = true - @provider.stub!(:compare_group).and_return(true) - @provider.stub!(:change_desc).and_return([ ]) + @provider.stub(:compare_group).and_return(true) + @provider.stub(:change_desc).and_return([ ]) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:create) end it "should set the new_resources updated flag when it creates the group if we call manage_group" do @provider.group_exists = true - @provider.stub!(:compare_group).and_return(true) - @provider.stub!(:change_desc).and_return(["Some changes are going to be done."]) - @provider.stub!(:manage_group).and_return(true) + @provider.stub(:compare_group).and_return(true) + @provider.stub(:change_desc).and_return(["Some changes are going to be done."]) + @provider.stub(:manage_group).and_return(true) @provider.run_action(:create) @new_resource.should be_updated end @@ -183,20 +183,20 @@ describe Chef::Provider::User do describe "when updating a group" do before(:each) do @provider.group_exists = true - @provider.stub!(:manage_group).and_return(true) + @provider.stub(:manage_group).and_return(true) end it "should run manage_group if the group exists and has mismatched attributes" do @provider.should_receive(:compare_group).and_return(true) - @provider.stub!(:change_desc).and_return(["Some changes are going to be done."]) + @provider.stub(:change_desc).and_return(["Some changes are going to be done."]) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:manage) end it "should set the new resources updated flag to true if manage_group is called" do - @provider.stub!(:compare_group).and_return(true) - @provider.stub!(:change_desc).and_return(["Some changes are going to be done."]) - @provider.stub!(:manage_group).and_return(true) + @provider.stub(:compare_group).and_return(true) + @provider.stub(:change_desc).and_return(["Some changes are going to be done."]) + @provider.stub(:manage_group).and_return(true) @provider.run_action(:manage) @new_resource.should be_updated end @@ -209,7 +209,7 @@ describe Chef::Provider::User do it "should not run manage_group if the group exists but has no differing attributes" do @provider.should_receive(:compare_group).and_return(false) - @provider.stub!(:change_desc).and_return(["Some changes are going to be done."]) + @provider.stub(:change_desc).and_return(["Some changes are going to be done."]) @provider.should_not_receive(:manage_group) @provider.run_action(:manage) end @@ -218,27 +218,27 @@ describe Chef::Provider::User do describe "when modifying the group" do before(:each) do @provider.group_exists = true - @provider.stub!(:manage_group).and_return(true) + @provider.stub(:manage_group).and_return(true) end it "should run manage_group if the group exists and has mismatched attributes" do @provider.should_receive(:compare_group).and_return(true) - @provider.stub!(:change_desc).and_return(["Some changes are going to be done."]) + @provider.stub(:change_desc).and_return(["Some changes are going to be done."]) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:modify) end it "should set the new resources updated flag to true if manage_group is called" do - @provider.stub!(:compare_group).and_return(true) - @provider.stub!(:change_desc).and_return(["Some changes are going to be done."]) - @provider.stub!(:manage_group).and_return(true) + @provider.stub(:compare_group).and_return(true) + @provider.stub(:change_desc).and_return(["Some changes are going to be done."]) + @provider.stub(:manage_group).and_return(true) @provider.run_action(:modify) @new_resource.should be_updated end it "should not run manage_group if the group exists but has no differing attributes" do @provider.should_receive(:compare_group).and_return(false) - @provider.stub!(:change_desc).and_return(["Some changes are going to be done."]) + @provider.stub(:change_desc).and_return(["Some changes are going to be done."]) @provider.should_not_receive(:manage_group) @provider.run_action(:modify) end @@ -253,20 +253,20 @@ describe Chef::Provider::User do it "should report which group members are missing if members are missing and appending to the group" do @new_resource.members << "user1" @new_resource.members << "user2" - @new_resource.stub!(:append).and_return true + @new_resource.stub(:append).and_return true @provider.compare_group.should be_true @provider.change_desc.should == [ "add missing member(s): user1, user2" ] end it "should report that the group members will be overwritten if not appending" do @new_resource.members << "user1" - @new_resource.stub!(:append).and_return false + @new_resource.stub(:append).and_return false @provider.compare_group.should be_true @provider.change_desc.should == [ "replace group members with new list of members" ] end it "should report the gid will be changed when it does not match" do - @current_resource.stub!(:gid).and_return("BADF00D") + @current_resource.stub(:gid).and_return("BADF00D") @provider.compare_group.should be_true @provider.change_desc.should == [ "change gid #{@current_resource.gid} to #{@new_resource.gid}" ] |