summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-08-24 08:10:47 -0700
committerGitHub <noreply@github.com>2016-08-24 08:10:47 -0700
commit92abbf75586cb3f64d98d8472309b55f1600b580 (patch)
tree5131378785c94452e966a46835def5eaf4857be4 /spec/support
parent35c11788a1150d74b2cd7c2d043b5e9199962455 (diff)
parent339e632ffb1779db885d922d8444be29c13c449c (diff)
downloadchef-92abbf75586cb3f64d98d8472309b55f1600b580.tar.gz
Merge pull request #5243 from chef/lcg/rewrite-linux-user-provider
Rewrite linux useradd provider
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb20
1 files changed, 10 insertions, 10 deletions
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 de851c4ad4..fc12b2d5b6 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -100,7 +100,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "should set useradd -r" do
@new_resource.system(true)
- expect(provider.useradd_options).to eq([ "-r" ])
+ expect(provider.useradd_options).to eq([ "-r", "-m" ])
end
end
@@ -111,21 +111,21 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
end
it "should set -m -d /homedir" do
- expect(provider.universal_options).to eq(%w{-d /wowaweea -m})
- expect(provider.useradd_options).to eq([])
+ expect(provider.universal_options).to eq(%w{-d /wowaweea})
+ expect(provider.usermod_options).to eq(%w{-m})
end
end
describe "when the resource has a different home directory and supports home directory management (using real attributes)" do
before do
- allow(@new_resource).to receive(:home).and_return("/wowaweea")
- allow(@new_resource).to receive(:manage_home).and_return(true)
- allow(@new_resource).to receive(:non_unique).and_return(false)
+ @new_resource.home("/wowaweea")
+ @new_resource.manage_home true
+ @new_resource.non_unique false
end
it "should set -m -d /homedir" do
- expect(provider.universal_options).to eql(%w{-d /wowaweea -m})
- expect(provider.useradd_options).to eq([])
+ expect(provider.universal_options).to eq(%w{-d /wowaweea})
+ expect(provider.usermod_options).to eq(%w{-m})
end
end
@@ -179,7 +179,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
command.concat(["-p", "abracadabra"]) if supported_useradd_options.key?("password")
command.concat([ "-s", "/usr/bin/zsh",
"-u", "1000",
- "-r",
+ "-r", "-m",
"adam" ])
expect(provider).to receive(:shell_out!).with(*command).and_return(true)
provider.create_user
@@ -220,7 +220,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
end
it "CHEF-3429: does not set -m if we aren't changing the home directory" do
- expect(provider).to receive(:updating_home?).and_return(false)
+ expect(provider).to receive(:updating_home?).at_least(:once).and_return(false)
command = ["usermod",
"-g", "23",
"adam" ]