summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Minshall <minshalljg@gmail.com>2015-02-22 17:59:36 -0800
committerJacob Minshall <minshalljg@gmail.com>2015-03-17 12:45:51 -0700
commit7204f72e91235fd52c6a97ed3169d31caf7235d1 (patch)
treedd884fdb345ec27cfa33d25ff3539acbd142b2f9
parentc76b988f83ea3cbaa5dd773577265ec5382a9a90 (diff)
downloadchef-7204f72e91235fd52c6a97ed3169d31caf7235d1.tar.gz
test for retention of suid bit
-rw-r--r--spec/support/shared/functional/securable_resource.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/support/shared/functional/securable_resource.rb b/spec/support/shared/functional/securable_resource.rb
index e016bb685d..2af6ef3a67 100644
--- a/spec/support/shared/functional/securable_resource.rb
+++ b/spec/support/shared/functional/securable_resource.rb
@@ -231,6 +231,24 @@ shared_examples_for "a securable resource with existing target" do
expect(resource.updated_by_last_action?).to eq(expect_updated?)
end
end
+
+ describe "when setting the suid bit", :requires_root do
+ before do
+ @suid_mode = 04776
+ resource.mode @suid_mode
+ resource.run_action(:create)
+ end
+
+ it "should set the suid bit" do
+ expect(File.lstat(path).mode & 007777).to eq(@suid_mode & 007777)
+ end
+
+ it "should retain the suid bit when updating the user" do
+ resource.user 1338
+ resource.run_action(:create)
+ expect(File.lstat(path).mode & 007777).to eq(@suid_mode & 007777)
+ end
+ end
end
context "on Windows", :windows_only do