summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRyan Cragun <ryan@chef.io>2019-09-10 13:56:41 -0600
committerRyan Cragun <ryan@chef.io>2019-09-10 21:12:26 -0600
commit1977fbf8410efc415b2ba8c59177b99ab2dcad62 (patch)
tree1d1ef128daf514731cb5b996c1782c1bd4eb54e0 /spec
parentb1a5a4f7e3eb30d30ebd1c5b9e22b299441350a1 (diff)
downloadchef-1977fbf8410efc415b2ba8c59177b99ab2dcad62.tar.gz
[macos] fix mac_user platform constraintsryan/fix-macos-build
Signed-off-by: Ryan Cragun <ryan@chef.io>
Diffstat (limited to 'spec')
-rw-r--r--spec/functional/resource/user/mac_user_spec.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/spec/functional/resource/user/mac_user_spec.rb b/spec/functional/resource/user/mac_user_spec.rb
index d01b08616e..102c2824bf 100644
--- a/spec/functional/resource/user/mac_user_spec.rb
+++ b/spec/functional/resource/user/mac_user_spec.rb
@@ -32,6 +32,11 @@ describe "Chef::Resource::User with Chef::Provider::User::MacUser provider", met
# Raised when the user is already cleaned
end
+ def ensure_file_cache_path_exists
+ path = Chef::Config["file_cache_path"]
+ FileUtils.mkdir_p(path) unless File.directory?(path)
+ end
+
def user_should_exist
expect(shell_out("/usr/bin/dscl . -read /Users/#{username}").error?).to be(false)
end
@@ -89,6 +94,7 @@ describe "Chef::Resource::User with Chef::Provider::User::MacUser provider", met
before do
clean_user
+ ensure_file_cache_path_exists
end
after(:each) do
@@ -148,10 +154,23 @@ c5adbbac718b7eb99463a7b679571e0f\
end
describe "when password is updated" do
- it "should update the password of the user" do
- user_resource.password("mykitchen")
- user_resource.run_action(:create)
- check_password("mykitchen")
+ describe "without salt" do
+ let(:salt) { nil }
+
+ it "it sets the password" do
+ user_resource.password("mykitchen")
+ user_resource.run_action(:create)
+ check_password("mykitchen")
+ end
+ end
+
+ describe "with salt and plaintext password" do
+ it "raises Chef::Exceptions::User" do
+ expect do
+ user_resource.password("notasha512")
+ user_resource.run_action(:create)
+ end.to raise_error(Chef::Exceptions::User)
+ end
end
end
end