summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-12-10 11:27:33 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2019-12-10 11:27:33 -0800
commit6a14b263f2905ccc173f84a789d916d1fe8ed821 (patch)
treeacf2f820d3d51afb16911e434bccb27107c9a375
parent4ef700e7a1543e73eca792c11b823c0c56f5b581 (diff)
downloadchef-lcg/fix-mac-user.tar.gz
add test for mac_user with no argslcg/fix-mac-user
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/user/mac.rb2
-rw-r--r--spec/functional/resource/user/mac_user_spec.rb40
2 files changed, 29 insertions, 13 deletions
diff --git a/lib/chef/provider/user/mac.rb b/lib/chef/provider/user/mac.rb
index 7b12eaec3c..a95e50b443 100644
--- a/lib/chef/provider/user/mac.rb
+++ b/lib/chef/provider/user/mac.rb
@@ -1,6 +1,6 @@
#
# Author:: Ryan Cragun (<ryan@chef.io>)
-# Copyright:: Copyright (c) 2019, Chef Software Inc.
+# Copyright:: Copyright (c) 2019-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/spec/functional/resource/user/mac_user_spec.rb b/spec/functional/resource/user/mac_user_spec.rb
index 102c2824bf..3c4963ac42 100644
--- a/spec/functional/resource/user/mac_user_spec.rb
+++ b/spec/functional/resource/user/mac_user_spec.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2019, Chef Software, Inc.
+# Copyright:: Copyright 2019-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -64,7 +64,7 @@ describe "Chef::Resource::User with Chef::Provider::User::MacUser provider", met
end
let(:username) do
- "greatchef"
+ "LaUbqR8goE"
end
let(:uid) { nil }
@@ -79,16 +79,16 @@ describe "Chef::Resource::User with Chef::Provider::User::MacUser provider", met
let(:user_resource) do
r = Chef::Resource::User::MacUser.new("TEST USER RESOURCE", run_context)
- r.username(username)
- r.uid(uid)
- r.gid(gid)
- r.home(home)
- r.shell(shell)
- r.comment(comment)
- r.manage_home(manage_home)
- r.password(password)
- r.salt(salt)
- r.iterations(iterations)
+ r.username(username) unless username.nil?
+ r.uid(uid) unless uid.nil?
+ r.gid(gid) unless gid.nil?
+ r.home(home) unless home.nil?
+ r.shell(shell) unless shell.nil?
+ r.comment(comment) unless comment.nil?
+ r.manage_home(manage_home) unless manage_home.nil?
+ r.password(password) unless password.nil?
+ r.salt(salt) unless salt.nil?
+ r.iterations(iterations) unless iterations.nil?
r
end
@@ -204,4 +204,20 @@ c5adbbac718b7eb99463a7b679571e0f\
end
end
+ describe "when called with no options" do
+ let(:uid) { nil }
+ let(:gid) { nil }
+ let(:home) { nil }
+ let(:manage_home) { nil }
+ let(:password) { nil }
+ let(:comment) { nil }
+ let(:shell) { nil }
+ let(:salt) { nil }
+ let(:iterations) { nil }
+
+ it "should not fail" do
+ user_resource.run_action(:create)
+ end
+ end
+
end