diff options
Diffstat (limited to 'spec/support/shared/functional/securable_resource.rb')
-rw-r--r-- | spec/support/shared/functional/securable_resource.rb | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/spec/support/shared/functional/securable_resource.rb b/spec/support/shared/functional/securable_resource.rb index b3c32356aa..917f1dae20 100644 --- a/spec/support/shared/functional/securable_resource.rb +++ b/spec/support/shared/functional/securable_resource.rb @@ -18,8 +18,8 @@ # limitations under the License. # -require 'etc' -require 'functional/resource/base' +require "etc" +require "functional/resource/base" shared_context "setup correct permissions" do if windows? @@ -38,9 +38,9 @@ shared_context "setup correct permissions" do # Root only context. before :each, :unix_only, :requires_root do if ohai[:platform] == "aix" - File.chown(Etc.getpwnam('guest').uid, 1337, path) + File.chown(Etc.getpwnam("guest").uid, 1337, path) else - File.chown(Etc.getpwnam('nobody').uid, 1337, path) + File.chown(Etc.getpwnam("nobody").uid, 1337, path) end end @@ -155,9 +155,9 @@ shared_examples_for "a securable resource with existing target" do context "on Unix", :unix_only do if ohai[:platform] == "aix" - let(:expected_user_name) { 'guest' } + let(:expected_user_name) { "guest" } else - let(:expected_user_name) { 'nobody' } + let(:expected_user_name) { "nobody" } end let(:expected_uid) { Etc.getpwnam(expected_user_name).uid } let(:desired_gid) { 1337 } @@ -197,7 +197,7 @@ shared_examples_for "a securable resource with existing target" do describe "when setting the permissions from octal given as a String" do before do - @mode_string = '776' + @mode_string = "776" resource.mode @mode_string resource.run_action(:create) end @@ -258,7 +258,7 @@ shared_examples_for "a securable resource with existing target" do describe "when setting group" do before do - resource.group('Administrators') + resource.group("Administrators") resource.run_action(:create) end @@ -273,8 +273,8 @@ shared_examples_for "a securable resource with existing target" do describe "when setting rights and deny_rights" do before do - resource.deny_rights(:modify, 'Guest') - resource.rights(:read, 'Guest') + resource.deny_rights(:modify, "Guest") + resource.rights(:read, "Guest") resource.run_action(:create) end @@ -303,7 +303,7 @@ shared_examples_for "a securable resource without existing target" do end it "sets owner when owner is specified" do - resource.owner 'Guest' + resource.owner "Guest" resource.run_action(:create) expect(descriptor.owner).to eq(SID.Guest) end @@ -322,7 +322,7 @@ shared_examples_for "a securable resource without existing target" do arbitrary_non_default_owner = SID.Guest expect(arbitrary_non_default_owner).not_to eq(SID.default_security_object_owner) - resource.owner 'Guest' # Change to arbitrary_non_default_owner once issue #1508 is fixed + resource.owner "Guest" # Change to arbitrary_non_default_owner once issue #1508 is fixed resource.run_action(:create) expect(descriptor.owner).to eq(arbitrary_non_default_owner) @@ -340,7 +340,7 @@ shared_examples_for "a securable resource without existing target" do end it "sets group when group is specified" do - resource.group 'Everyone' + resource.group "Everyone" resource.run_action(:create) expect(descriptor.group).to eq(SID.Everyone) end @@ -353,7 +353,7 @@ shared_examples_for "a securable resource without existing target" do arbitrary_non_default_group = SID.Everyone expect(arbitrary_non_default_group).not_to eq(SID.default_security_object_group) - resource.group 'Everyone' # Change to arbitrary_non_default_group once issue #1508 is fixed + resource.group "Everyone" # Change to arbitrary_non_default_group once issue #1508 is fixed resource.run_action(:create) expect(descriptor.group).to eq(arbitrary_non_default_group) @@ -366,45 +366,45 @@ shared_examples_for "a securable resource without existing target" do describe "with rights and deny_rights attributes" do it "correctly sets :read rights" do - resource.rights(:read, 'Guest') + resource.rights(:read, "Guest") resource.run_action(:create) expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_read_perms)) end it "correctly sets :read_execute rights" do - resource.rights(:read_execute, 'Guest') + resource.rights(:read_execute, "Guest") resource.run_action(:create) expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_read_execute_perms)) end it "correctly sets :write rights" do - resource.rights(:write, 'Guest') + resource.rights(:write, "Guest") resource.run_action(:create) expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_write_perms)) end it "correctly sets :modify rights" do - resource.rights(:modify, 'Guest') + resource.rights(:modify, "Guest") resource.run_action(:create) expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_modify_perms)) end it "correctly sets :full_control rights" do - resource.rights(:full_control, 'Guest') + resource.rights(:full_control, "Guest") resource.run_action(:create) expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_full_control_perms)) end it "correctly sets deny_rights" do # deny is an ACE with full rights, but is a deny type ace, not an allow type - resource.deny_rights(:full_control, 'Guest') + resource.deny_rights(:full_control, "Guest") resource.run_action(:create) expect(explicit_aces).to eq(denied_acl(SID.Guest, expected_full_control_perms)) end it "Sets multiple rights" do - resource.rights(:read, 'Everyone') - resource.rights(:modify, 'Guest') + resource.rights(:read, "Everyone") + resource.rights(:modify, "Guest") resource.run_action(:create) expect(explicit_aces).to eq( @@ -414,8 +414,8 @@ shared_examples_for "a securable resource without existing target" do end it "Sets deny_rights ahead of rights" do - resource.rights(:read, 'Everyone') - resource.deny_rights(:modify, 'Guest') + resource.rights(:read, "Everyone") + resource.deny_rights(:modify, "Guest") resource.run_action(:create) expect(explicit_aces).to eq( @@ -425,8 +425,8 @@ shared_examples_for "a securable resource without existing target" do end it "Sets deny_rights ahead of rights when specified in reverse order" do - resource.deny_rights(:modify, 'Guest') - resource.rights(:read, 'Everyone') + resource.deny_rights(:modify, "Guest") + resource.rights(:read, "Everyone") resource.run_action(:create) expect(explicit_aces).to eq( @@ -445,9 +445,9 @@ shared_examples_for "a securable resource without existing target" do it "respects mode in string form as an octal number" do #on windows, mode cannot modify owner and/or group permissons #unless the owner and/or group as appropriate is specified - resource.mode '400' - resource.owner 'Guest' - resource.group 'Everyone' + resource.mode "400" + resource.owner "Guest" + resource.group "Everyone" resource.run_action(:create) expect(explicit_aces).to eq([ ACE.access_allowed(SID.Guest, Security::FILE_GENERIC_READ) ]) @@ -455,7 +455,7 @@ shared_examples_for "a securable resource without existing target" do it "respects mode in numeric form as a ruby-interpreted octal" do resource.mode 0700 - resource.owner 'Guest' + resource.owner "Guest" resource.run_action(:create) expect(explicit_aces).to eq([ ACE.access_allowed(SID.Guest, Security::FILE_GENERIC_READ | Security::FILE_GENERIC_WRITE | Security::FILE_GENERIC_EXECUTE | Security::DELETE) ]) @@ -463,8 +463,8 @@ shared_examples_for "a securable resource without existing target" do it "respects the owner, group and everyone bits of mode" do resource.mode 0754 - resource.owner 'Guest' - resource.group 'Administrators' + resource.owner "Guest" + resource.group "Administrators" resource.run_action(:create) expect(explicit_aces).to eq([ @@ -476,8 +476,8 @@ shared_examples_for "a securable resource without existing target" do it "respects the individual read, write and execute bits of mode" do resource.mode 0421 - resource.owner 'Guest' - resource.group 'Administrators' + resource.owner "Guest" + resource.group "Administrators" resource.run_action(:create) expect(explicit_aces).to eq([ @@ -487,7 +487,7 @@ shared_examples_for "a securable resource without existing target" do ]) end - it 'warns when mode tries to set owner bits but owner is not specified' do + it "warns when mode tries to set owner bits but owner is not specified" do @warn = [] allow(Chef::Log).to receive(:warn) { |msg| @warn << msg } @@ -497,7 +497,7 @@ shared_examples_for "a securable resource without existing target" do expect(@warn.include?("Mode 400 includes bits for the owner, but owner is not specified")).to be_truthy end - it 'warns when mode tries to set group bits but group is not specified' do + it "warns when mode tries to set group bits but group is not specified" do @warn = [] allow(Chef::Log).to receive(:warn) { |msg| @warn << msg } @@ -511,7 +511,7 @@ shared_examples_for "a securable resource without existing target" do it "does not inherit aces if inherits is set to false" do # We need at least one ACE if we're creating a securable without # inheritance - resource.rights(:full_control, 'Administrators') + resource.rights(:full_control, "Administrators") resource.inherits(false) resource.run_action(:create) |