summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorartursitarski <artur.sitarski@gmail.com>2016-01-27 01:19:47 +0100
committerartursitarski <artur.sitarski@gmail.com>2016-02-02 23:22:40 +0100
commit8e0d3cab1775cc016224f2b00f8e143ee52f0304 (patch)
treeaee39197b3a123e0bd9410654c7c8b827832acda
parent7393698d07ec082d9ce82fb02f5e2ce3ae4acf77 (diff)
downloadchef-8e0d3cab1775cc016224f2b00f8e143ee52f0304.tar.gz
Updated spec
-rw-r--r--spec/functional/resource/user/useradd_spec.rb3
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb8
2 files changed, 7 insertions, 4 deletions
diff --git a/spec/functional/resource/user/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb
index d0ae40a35f..d7b312e0fc 100644
--- a/spec/functional/resource/user/useradd_spec.rb
+++ b/spec/functional/resource/user/useradd_spec.rb
@@ -145,6 +145,7 @@ describe Chef::Provider::User::Useradd, metadata do
let(:password) { nil }
let(:system) { false }
let(:comment) { nil }
+ let(:shell) { nil }
let(:user_resource) do
r = Chef::Resource::User.new("TEST USER RESOURCE", run_context)
@@ -155,6 +156,7 @@ describe Chef::Provider::User::Useradd, metadata do
r.manage_home(manage_home)
r.password(password)
r.system(system)
+ r.shell(shell)
r
end
@@ -631,6 +633,7 @@ describe Chef::Provider::User::Useradd, metadata do
context "when the user exists" do
include_context "user exists for lock/unlock"
+ let(:shell) { "/bin/bash" }
before do
begin
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 b4d640d046..5fc5c03523 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -365,15 +365,15 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
end
describe "when locking the user" do
- it "should run usermod -L with the new resources username" do
- expect(provider).to receive(:shell_out!).with("usermod", "-L", @new_resource.username)
+ it "should run usermod -L -s /bin/false with the new resources username" do
+ expect(provider).to receive(:shell_out!).with("usermod", "-L", "-s", "/bin/false", @new_resource.username)
provider.lock_user
end
end
describe "when unlocking the user" do
- it "should run usermod -L with the new resources username" do
- expect(provider).to receive(:shell_out!).with("usermod", "-U", @new_resource.username)
+ it "should run usermod -U -s with the new resources shell and username" do
+ expect(provider).to receive(:shell_out!).with("usermod", "-U", "-s", @new_resource.shell, @new_resource.username)
provider.unlock_user
end
end