summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskippy <jonathan.yates.jones@gmail.com>2019-11-17 06:50:51 +0000
committerskippy <jonathan.yates.jones@gmail.com>2019-11-17 06:50:51 +0000
commit8d69df6f0bbfc08a17bdd7af5f17aff345203274 (patch)
tree3798e009ecbeff93635d05f8971ec3edf6655f75
parentec4547ebe04dd910ecedc6193cbf53e38f05d4cd (diff)
downloadchef-8d69df6f0bbfc08a17bdd7af5f17aff345203274.tar.gz
Resolved issues with tests not receiving exactly what they expected.
Resolved new method in linux_user not returning the correct array. Signed-off-by: Jonathan Jones <gitmaster@thespooky.house>
-rw-r--r--lib/chef/provider/user/linux.rb2
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb10
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/chef/provider/user/linux.rb b/lib/chef/provider/user/linux.rb
index 9c49f4c31d..7e10957717 100644
--- a/lib/chef/provider/user/linux.rb
+++ b/lib/chef/provider/user/linux.rb
@@ -62,7 +62,7 @@ class Chef
if new_resource.manage_home
home_dir_exist = shell_out!("test", "-d", new_resource.home, returns: [1])
if home_dir_exist.error?
- opts << 12
+ ret_codes << 12
end
end
end
diff --git a/spec/support/shared/unit/provider/useradd_based_user_provider.rb b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
index a30f543e72..997d7350be 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -159,7 +159,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
"-u", "1000",
"-d", "/Users/mud",
"-m",
- "adam" ])
+ "adam", {:returns=>[0,12]}])
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
provider.create_user
end
@@ -180,7 +180,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
command.concat([ "-s", "/usr/bin/zsh",
"-u", "1000",
"-r", "-m",
- "adam" ])
+ "adam", {:returns=>[0]} ])
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
provider.create_user
end
@@ -203,7 +203,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
"-g", "23",
"-d", "/Users/mud",
"-m",
- "adam" ]
+ "adam", {:returns=>[0,12]}]
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
provider.manage_user
end
@@ -214,7 +214,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
"-g", "23",
"-d", "/Users/mud",
"-m",
- "adam" ]
+ "adam", {:returns=>[0]}]
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
provider.manage_user
end
@@ -223,7 +223,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
expect(provider).to receive(:updating_home?).at_least(:once).and_return(false)
command = ["usermod",
"-g", "23",
- "adam" ]
+ "adam", {:returns=>[0]} ]
expect(provider).to receive(:shell_out_compacted!).with(*command).and_return(true)
provider.manage_user
end