summaryrefslogtreecommitdiff
path: root/spec/unit/provider/user
diff options
context:
space:
mode:
authorAnand Suresh <anandsuresh@gmail.com>2014-05-24 20:56:49 -0700
committerAnand Suresh <anandsuresh@gmail.com>2014-05-24 20:56:49 -0700
commitdbc8f0be93cddbb9ee5bf6351dea4ce658a8c909 (patch)
tree0c707e189871cb224f020c4d7599b08276cd8d03 /spec/unit/provider/user
parentd97bc318c6e0c8afbdfd100c7c61e0fdc9e43398 (diff)
downloadchef-dbc8f0be93cddbb9ee5bf6351dea4ce658a8c909.tar.gz
Updated unit test for user provider pw
Diffstat (limited to 'spec/unit/provider/user')
-rw-r--r--spec/unit/provider/user/pw_spec.rb25
1 files changed, 21 insertions, 4 deletions
diff --git a/spec/unit/provider/user/pw_spec.rb b/spec/unit/provider/user/pw_spec.rb
index 1d5ad38c9c..a577a57de9 100644
--- a/spec/unit/provider/user/pw_spec.rb
+++ b/spec/unit/provider/user/pw_spec.rb
@@ -164,10 +164,27 @@ describe Chef::Provider::User::Pw do
@pid, @stdin, @stdout, @stderr = nil, nil, nil, nil
end
- it "should check for differences in password between the new and current resources" do
- @current_resource.should_receive(:password)
- @new_resource.should_receive(:password)
- @provider.modify_password
+ describe "and the new password has not been specified" do
+ before(:each) do
+ @new_resource.stub(:password).and_return(nil)
+ end
+
+ it "logs an appropriate message" do
+ Chef::Log.should_receive(:debug).with("user[adam] no change needed to password")
+ @provider.modify_password
+ end
+ end
+
+ describe "and the new password has been specified" do
+ before(:each) do
+ @new_resource.stub(:password).and_return("abracadabra")
+ end
+
+ it "should check for differences in password between the new and current resources" do
+ @current_resource.should_receive(:password)
+ @new_resource.should_receive(:password)
+ @provider.modify_password
+ end
end
describe "and the passwords are identical" do