diff options
author | adamedx <adamedx@gmail.com> | 2016-02-15 07:48:47 -0800 |
---|---|---|
committer | nimisha <nimisha.sharad@msystechnologies.com> | 2017-02-02 18:00:30 +0530 |
commit | aa155445b92e87baf1895ce092da3ae4c93117e6 (patch) | |
tree | cbb3f01bafeb456866e63674231f64386dc86f41 /spec/unit/provider | |
parent | f0809fbb1c08ad14faed9c51f861a94373a39d27 (diff) | |
download | chef-aa155445b92e87baf1895ce092da3ae4c93117e6.tar.gz |
Rubocop violations in execute resource alternate user implementation
Diffstat (limited to 'spec/unit/provider')
-rw-r--r-- | spec/unit/provider/execute_spec.rb | 22 | ||||
-rw-r--r-- | spec/unit/provider/script_spec.rb | 30 |
2 files changed, 26 insertions, 26 deletions
diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb index e83e347fb6..a579b389df 100644 --- a/spec/unit/provider/execute_spec.rb +++ b/spec/unit/provider/execute_spec.rb @@ -251,12 +251,12 @@ describe Chef::Provider::Execute do context "when the username is specified" do before do - new_resource.user('starchild') + new_resource.user("starchild") end context "when the domain is specified" do before do - new_resource.domain('mydomain') + new_resource.domain("mydomain") end it "should raise an error if the password is not specified" do @@ -265,7 +265,7 @@ describe Chef::Provider::Execute do end it "should not raise an error if the password is specified" do - expect(new_resource).to receive(:password).at_least(1).times.and_return('we.funk!') + expect(new_resource).to receive(:password).at_least(1).times.and_return("we.funk!") expect { provider.run_action(:run) }.not_to raise_error end end @@ -281,7 +281,7 @@ describe Chef::Provider::Execute do end it "should not raise an error if the password is specified" do - expect(new_resource).to receive(:password).at_least(1).times.and_return('we.funk!') + expect(new_resource).to receive(:password).at_least(1).times.and_return("we.funk!") expect { provider.run_action(:run) }.not_to raise_error end @@ -294,18 +294,18 @@ describe Chef::Provider::Execute do end it "should raise an error if the password is specified" do - expect(new_resource).to receive(:password).at_least(1).times.and_return('we.funk!') + expect(new_resource).to receive(:password).at_least(1).times.and_return("we.funk!") expect { provider.run_action(:run) }.to raise_error(ArgumentError) end it "should raise an error if the domain is specified" do - expect(new_resource).to receive(:domain).at_least(1).times.and_return('mothership') + expect(new_resource).to receive(:domain).at_least(1).times.and_return("mothership") expect { provider.run_action(:run) }.to raise_error(ArgumentError) end it "should raise an error if the domain and password are specified" do - expect(new_resource).to receive(:password).at_least(1).times.and_return('we.funk!') - expect(new_resource).to receive(:domain).at_least(1).times.and_return('mothership') + expect(new_resource).to receive(:password).at_least(1).times.and_return("we.funk!") + expect(new_resource).to receive(:domain).at_least(1).times.and_return("mothership") expect { provider.run_action(:run) }.to raise_error(ArgumentError) end end @@ -317,16 +317,16 @@ describe Chef::Provider::Execute do end it "should not raise an error if the user is specified" do - new_resource.user('starchild') + new_resource.user("starchild") end it "should raise an error if the password is specified" do - expect(new_resource).to receive(:password).and_return('we.funk!') + expect(new_resource).to receive(:password).and_return("we.funk!") expect { provider.run_action(:run) }.to raise_error(Chef::Exceptions::UnsupportedPlatform) end it "should raise an error if the domain is specified" do - expect(new_resource).to receive(:domain).and_return('we.funk!') + expect(new_resource).to receive(:domain).and_return("we.funk!") expect { provider.run_action(:run) }.to raise_error(Chef::Exceptions::UnsupportedPlatform) end end diff --git a/spec/unit/provider/script_spec.rb b/spec/unit/provider/script_spec.rb index e7f09cf275..2f024c4c29 100644 --- a/spec/unit/provider/script_spec.rb +++ b/spec/unit/provider/script_spec.rb @@ -57,31 +57,31 @@ describe Chef::Provider::Script, "action_run" do end context "when configuring the script file's security" do - context 'when not running on Windows' do + context "when not running on Windows" do before do allow(::Chef::Platform).to receive(:windows?).and_return(false) end context "#set_owner_and_group" do it "sets the owner and group for the script file" do - new_resource.user 'toor' - new_resource.group 'wheel' - expect(FileUtils).to receive(:chown).with('toor', 'wheel', tempfile.path) + new_resource.user "toor" + new_resource.group "wheel" + expect(FileUtils).to receive(:chown).with("toor", "wheel", tempfile.path) provider.set_owner_and_group end end end - context 'when running on Windows' do + context "when running on Windows" do before do allow(::Chef::Platform).to receive(:windows?).and_return(true) expect(new_resource.user).to eq(nil) - stub_const('Chef::ReservedNames::Win32::API::Security::GENERIC_READ', 1) - stub_const('Chef::ReservedNames::Win32::API::Security::GENERIC_EXECUTE', 4) - stub_const('Chef::ReservedNames::Win32::Security', Class.new) - stub_const('Chef::ReservedNames::Win32::Security::SecurableObject', Class.new) - stub_const('Chef::ReservedNames::Win32::Security::SID', Class.new) - stub_const('Chef::ReservedNames::Win32::Security::ACE', Class.new) - stub_const('Chef::ReservedNames::Win32::Security::ACL', Class.new) + stub_const("Chef::ReservedNames::Win32::API::Security::GENERIC_READ", 1) + stub_const("Chef::ReservedNames::Win32::API::Security::GENERIC_EXECUTE", 4) + stub_const("Chef::ReservedNames::Win32::Security", Class.new) + stub_const("Chef::ReservedNames::Win32::Security::SecurableObject", Class.new) + stub_const("Chef::ReservedNames::Win32::Security::SID", Class.new) + stub_const("Chef::ReservedNames::Win32::Security::ACE", Class.new) + stub_const("Chef::ReservedNames::Win32::Security::ACL", Class.new) end context "when an alternate user is not specified" do @@ -93,10 +93,10 @@ describe Chef::Provider::Script, "action_run" do end context "when an alternate user is specified" do - let(:security_descriptor) { instance_double('Chef::ReservedNames::Win32::Security::SecurityDescriptor', :dacl => []) } - let(:securable_object) { instance_double('Chef::ReservedNames::Win32::Security::SecurableObject', :security_descriptor => security_descriptor, :dacl= => nil) } + let(:security_descriptor) { instance_double("Chef::ReservedNames::Win32::Security::SecurityDescriptor", :dacl => []) } + let(:securable_object) { instance_double("Chef::ReservedNames::Win32::Security::SecurableObject", :security_descriptor => security_descriptor, :dacl= => nil) } it "sets the script file's security descriptor" do - new_resource.user('toor') + new_resource.user("toor") expect(Chef::ReservedNames::Win32::Security::SecurableObject).to receive(:new).and_return(securable_object) expect(Chef::ReservedNames::Win32::Security::SID).to receive(:from_account).and_return(nil) expect(Chef::ReservedNames::Win32::Security::ACE).to receive(:access_allowed).and_return(nil) |