summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-02 15:50:39 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-02 15:50:39 -0700
commitf50ffe2b1b3b0afc7aa2b01a9356e439f78a5fcd (patch)
tree204cefb3c64929278dc7e6a7f3de220475154533
parent36075b93536da78cd50ffe4eebe1ae4613a04ec9 (diff)
downloadchef-f50ffe2b1b3b0afc7aa2b01a9356e439f78a5fcd.tar.gz
tweak Lint/BlockAlignment
Lint/BlockAlignment: Enabled: true EnforcedStyleAlignWith: start_of_block this works better with Layout/MultilineMethodCallIndentation to force indentation of multiline method calls that wind up with multiline blocks. i'd probably pull back the end to match with the start of the expression but this gets the indentation level inside the block correct. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/package/windows/exe.rb6
-rw-r--r--lib/chef/provider/package/windows/msi.rb12
-rw-r--r--lib/chef/provider/remote_file.rb18
-rw-r--r--lib/chef/provider/service/debian.rb18
-rw-r--r--lib/chef/provider/service/windows.rb4
-rw-r--r--lib/chef/resource/dnf_package.rb24
-rw-r--r--lib/chef/resource/launchd.rb76
-rw-r--r--lib/chef/resource/locale.rb26
-rw-r--r--lib/chef/resource/windows_firewall_rule.rb6
-rw-r--r--lib/chef/win32/security/sid.rb12
-rw-r--r--spec/support/mock/platform.rb4
-rw-r--r--spec/unit/knife/core/node_editor_spec.rb16
-rw-r--r--spec/unit/property/state_spec.rb44
-rw-r--r--spec/unit/provider/mount/mount_spec.rb22
-rw-r--r--spec/unit/provider/powershell_script_spec.rb20
-rw-r--r--spec/unit/provider/service/windows_spec.rb16
-rw-r--r--spec/unit/resource/windows_service_spec.rb10
17 files changed, 167 insertions, 167 deletions
diff --git a/lib/chef/provider/package/windows/exe.rb b/lib/chef/provider/package/windows/exe.rb
index c7460f938e..947f66e238 100644
--- a/lib/chef/provider/package/windows/exe.rb
+++ b/lib/chef/provider/package/windows/exe.rb
@@ -72,9 +72,9 @@ class Chef
uninstall_version = new_resource.version || current_installed_version
uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) }
.map(&:uninstall_string).uniq.each do |uninstall_string|
- logger.trace("Registry provided uninstall string for #{new_resource} is '#{uninstall_string}'")
- shell_out!(uninstall_command(uninstall_string), timeout: new_resource.timeout, returns: new_resource.returns)
- end
+ logger.trace("Registry provided uninstall string for #{new_resource} is '#{uninstall_string}'")
+ shell_out!(uninstall_command(uninstall_string), timeout: new_resource.timeout, returns: new_resource.returns)
+ end
end
private
diff --git a/lib/chef/provider/package/windows/msi.rb b/lib/chef/provider/package/windows/msi.rb
index 0298ad17c5..a6807afc17 100644
--- a/lib/chef/provider/package/windows/msi.rb
+++ b/lib/chef/provider/package/windows/msi.rb
@@ -82,12 +82,12 @@ class Chef
uninstall_version = new_resource.version || installed_version
uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) }
.map(&:uninstall_string).uniq.each do |uninstall_string|
- uninstall_string = "msiexec /x #{uninstall_string.match(/{.*}/)}"
- uninstall_string += expand_options(new_resource.options)
- uninstall_string += " /q" unless uninstall_string.downcase =~ / \/q/
- logger.trace("#{new_resource} removing MSI package version using '#{uninstall_string}'")
- shell_out!(uninstall_string, timeout: new_resource.timeout, returns: new_resource.returns)
- end
+ uninstall_string = "msiexec /x #{uninstall_string.match(/{.*}/)}"
+ uninstall_string += expand_options(new_resource.options)
+ uninstall_string += " /q" unless uninstall_string.downcase =~ / \/q/
+ logger.trace("#{new_resource} removing MSI package version using '#{uninstall_string}'")
+ shell_out!(uninstall_string, timeout: new_resource.timeout, returns: new_resource.returns)
+ end
end
end
end
diff --git a/lib/chef/provider/remote_file.rb b/lib/chef/provider/remote_file.rb
index 4427680b51..a2506d6a15 100644
--- a/lib/chef/provider/remote_file.rb
+++ b/lib/chef/provider/remote_file.rb
@@ -32,18 +32,18 @@ class Chef
def define_resource_requirements
[ new_resource.remote_user, new_resource.remote_domain,
new_resource.remote_password ].each do |prop|
- requirements.assert(:all_actions) do |a|
- a.assertion do
- if prop
- node[:platform_family] == "windows"
- else
- true
+ requirements.assert(:all_actions) do |a|
+ a.assertion do
+ if prop
+ node[:platform_family] == "windows"
+ else
+ true
+ end
end
+ a.failure_message Chef::Exceptions::UnsupportedPlatform, "'remote_user', 'remote_domain' and 'remote_password' properties are supported only for Windows platform"
+ a.whyrun("Assuming that the platform is Windows while passing 'remote_user', 'remote_domain' and 'remote_password' properties")
end
- a.failure_message Chef::Exceptions::UnsupportedPlatform, "'remote_user', 'remote_domain' and 'remote_password' properties are supported only for Windows platform"
- a.whyrun("Assuming that the platform is Windows while passing 'remote_user', 'remote_domain' and 'remote_password' properties")
end
- end
super
end
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index 3e1d6e7652..de76ed1416 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -58,15 +58,15 @@ class Chef
a.whyrun ["Unable to determine priority of service, assuming service would have been correctly installed earlier in the run.",
"Assigning temporary priorities to continue.",
"If this service is not properly installed prior to this point, this will fail."] do
- temp_priorities = { "6" => [:stop, "20"],
- "0" => [:stop, "20"],
- "1" => [:stop, "20"],
- "2" => [:start, "20"],
- "3" => [:start, "20"],
- "4" => [:start, "20"],
- "5" => [:start, "20"] }
- current_resource.priority(temp_priorities)
- end
+ temp_priorities = { "6" => [:stop, "20"],
+ "0" => [:stop, "20"],
+ "1" => [:stop, "20"],
+ "2" => [:start, "20"],
+ "3" => [:start, "20"],
+ "4" => [:start, "20"],
+ "5" => [:start, "20"] }
+ current_resource.priority(temp_priorities)
+ end
end
end
diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb
index 750da6d1fd..e1bdabce42 100644
--- a/lib/chef/provider/service/windows.rb
+++ b/lib/chef/provider/service/windows.rb
@@ -211,8 +211,8 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
converge_if_changed :service_type, :startup_type, :error_control,
:binary_path_name, :load_order_group, :dependencies,
:run_as_user, :display_name, :description do
- Win32::Service.configure(windows_service_config(:configure))
- end
+ Win32::Service.configure(windows_service_config(:configure))
+ end
converge_delayed_start
end
diff --git a/lib/chef/resource/dnf_package.rb b/lib/chef/resource/dnf_package.rb
index a89f6bfcff..52c739beb9 100644
--- a/lib/chef/resource/dnf_package.rb
+++ b/lib/chef/resource/dnf_package.rb
@@ -56,18 +56,18 @@ class Chef
description: "Flush the in-memory cache before or after a DNF operation that installs, upgrades, or removes a package. DNF automatically synchronizes remote metadata to a local cache. The #{Chef::Dist::CLIENT} creates a copy of the local cache, and then stores it in-memory during the #{Chef::Dist::CLIENT} run. The in-memory cache allows packages to be installed during the #{Chef::Dist::CLIENT} run without the need to continue synchronizing the remote metadata to the local cache while the #{Chef::Dist::CLIENT} run is in-progress.",
default: { before: false, after: false },
coerce: proc { |v|
- if v.is_a?(Hash)
- v
- elsif v.is_a?(Array)
- v.each_with_object({}) { |arg, obj| obj[arg] = true }
- elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
- { before: v, after: v }
- elsif v == :before
- { before: true, after: false }
- elsif v == :after
- { after: true, before: false }
- end
- }
+ if v.is_a?(Hash)
+ v
+ elsif v.is_a?(Array)
+ v.each_with_object({}) { |arg, obj| obj[arg] = true }
+ elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
+ { before: v, after: v }
+ elsif v == :before
+ { before: true, after: false }
+ elsif v == :after
+ { after: true, before: false }
+ end
+ }
def allow_downgrade(arg = nil)
if !arg.nil?
diff --git a/lib/chef/resource/launchd.rb b/lib/chef/resource/launchd.rb
index 6cc697eee8..39d95bbf69 100644
--- a/lib/chef/resource/launchd.rb
+++ b/lib/chef/resource/launchd.rb
@@ -77,54 +77,54 @@ class Chef
description: "A Hash (similar to crontab) that defines the calendar frequency at which a job is started or an Array.",
coerce: proc { |type|
# Coerce into an array of hashes to make validation easier
- array = if type.is_a?(Array)
- type
- else
- [type]
- end
+ array = if type.is_a?(Array)
+ type
+ else
+ [type]
+ end
# Check to make sure that our array only has hashes
- unless array.all? { |obj| obj.is_a?(Hash) }
- error_msg = "start_calendar_interval must be a single hash or an array of hashes!"
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
+ unless array.all? { |obj| obj.is_a?(Hash) }
+ error_msg = "start_calendar_interval must be a single hash or an array of hashes!"
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
# Make sure the hashes don't have any incorrect keys/values
- array.each do |entry|
- allowed_keys = %w{Minute Hour Day Weekday Month}
- unless entry.keys.all? { |key| allowed_keys.include?(key) }
- failed_keys = entry.keys.reject { |k| allowed_keys.include?(k) }.join(", ")
- error_msg = "The following key(s): #{failed_keys} are invalid for start_calendar_interval, must be one of: #{allowed_keys.join(", ")}"
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
-
- unless entry.values.all? { |val| val.is_a?(Integer) }
- failed_values = entry.values.reject { |val| val.is_a?(Integer) }.join(", ")
- error_msg = "Invalid value(s) (#{failed_values}) for start_calendar_interval item. Values must be integers!"
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
- end
+ array.each do |entry|
+ allowed_keys = %w{Minute Hour Day Weekday Month}
+ unless entry.keys.all? { |key| allowed_keys.include?(key) }
+ failed_keys = entry.keys.reject { |k| allowed_keys.include?(k) }.join(", ")
+ error_msg = "The following key(s): #{failed_keys} are invalid for start_calendar_interval, must be one of: #{allowed_keys.join(", ")}"
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+
+ unless entry.values.all? { |val| val.is_a?(Integer) }
+ failed_values = entry.values.reject { |val| val.is_a?(Integer) }.join(", ")
+ error_msg = "Invalid value(s) (#{failed_values}) for start_calendar_interval item. Values must be integers!"
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+ end
# Don't return array if we only have one entry
- if array.size == 1
- array.first
- else
- array
- end
- }
+ if array.size == 1
+ array.first
+ else
+ array
+ end
+ }
property :type, String,
description: "The type of resource. Possible values: daemon (default), agent.",
default: "daemon", coerce: proc { |type|
- type = type ? type.downcase : "daemon"
- types = %w{daemon agent}
-
- unless types.include?(type)
- error_msg = "type must be daemon or agent"
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
- type
- }
+ type = type ? type.downcase : "daemon"
+ types = %w{daemon agent}
+
+ unless types.include?(type)
+ error_msg = "type must be daemon or agent"
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+ type
+ }
# Apple LaunchD Keys
property :abandon_process_group, [ TrueClass, FalseClass ],
diff --git a/lib/chef/resource/locale.rb b/lib/chef/resource/locale.rb
index f833a4e7d3..331786a02f 100644
--- a/lib/chef/resource/locale.rb
+++ b/lib/chef/resource/locale.rb
@@ -40,19 +40,19 @@ class Chef
description: "A Hash of LC_* env variables in the form of ({ 'LC_ENV_VARIABLE' => 'VALUE' }).",
default: lazy { {} },
coerce: proc { |h|
- if h.respond_to?(:keys)
- invalid_keys = h.keys - LC_VARIABLES
- unless invalid_keys.empty?
- error_msg = "Key of option lc_env must be equal to one of: \"#{LC_VARIABLES.join('", "')}\"! You passed \"#{invalid_keys.join(', ')}\"."
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
- end
- unless h.values.all? { |x| x =~ LOCALE_REGEX }
- error_msg = "Values of option lc_env should be non-empty string without any leading whitespaces."
- raise Chef::Exceptions::ValidationFailed, error_msg
- end
- h
- }
+ if h.respond_to?(:keys)
+ invalid_keys = h.keys - LC_VARIABLES
+ unless invalid_keys.empty?
+ error_msg = "Key of option lc_env must be equal to one of: \"#{LC_VARIABLES.join('", "')}\"! You passed \"#{invalid_keys.join(', ')}\"."
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+ end
+ unless h.values.all? { |x| x =~ LOCALE_REGEX }
+ error_msg = "Values of option lc_env should be non-empty string without any leading whitespaces."
+ raise Chef::Exceptions::ValidationFailed, error_msg
+ end
+ h
+ }
# @deprecated Use {#lc_env} instead of this property.
# {#lc_env} uses Hash with specific LC var as key.
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index 5ac38bc8b7..28144d2805 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -121,9 +121,9 @@ class Chef
if current_resource
converge_if_changed :rule_name, :local_address, :local_port, :remote_address, :remote_port, :direction,
:protocol, :firewall_action, :profile, :program, :service, :interface_type, :enabled do
- cmd = firewall_command("Set")
- powershell_out!(cmd)
- end
+ cmd = firewall_command("Set")
+ powershell_out!(cmd)
+ end
else
converge_by("create firewall rule #{new_resource.rule_name}") do
cmd = firewall_command("New")
diff --git a/lib/chef/win32/security/sid.rb b/lib/chef/win32/security/sid.rb
index 0d1a9138ae..a8dbb56a2f 100644
--- a/lib/chef/win32/security/sid.rb
+++ b/lib/chef/win32/security/sid.rb
@@ -249,15 +249,15 @@ class Chef
SERVICE_ACCOUNT_USERS = [self.LocalSystem,
self.NtLocal,
self.NtNetwork].flat_map do |user_type|
- [user_type.account_simple_name.upcase,
- user_type.account_name.upcase]
- end.freeze
+ [user_type.account_simple_name.upcase,
+ user_type.account_name.upcase]
+ end.freeze
BUILT_IN_GROUPS = [self.BuiltinAdministrators,
self.BuiltinUsers, self.Guests].flat_map do |user_type|
- [user_type.account_simple_name.upcase,
- user_type.account_name.upcase]
- end.freeze
+ [user_type.account_simple_name.upcase,
+ user_type.account_name.upcase]
+ end.freeze
SYSTEM_USER = SERVICE_ACCOUNT_USERS + BUILT_IN_GROUPS
diff --git a/spec/support/mock/platform.rb b/spec/support/mock/platform.rb
index c6670827f9..2cf605c741 100644
--- a/spec/support/mock/platform.rb
+++ b/spec/support/mock/platform.rb
@@ -19,7 +19,7 @@ def platform_mock(platform = :unix)
mock_constants({ "RUBY_PLATFORM" => (platform == :windows ? "i386-mingw32" : "x86_64-darwin11.2.0"),
"File::PATH_SEPARATOR" => (platform == :windows ? ";" : ":"),
"File::ALT_SEPARATOR" => (platform == :windows ? "\\" : nil) }) do
- yield
- end
+ yield
+ end
end
end
diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb
index ccf6776593..493de3c5b1 100644
--- a/spec/unit/knife/core/node_editor_spec.rb
+++ b/spec/unit/knife/core/node_editor_spec.rb
@@ -44,13 +44,13 @@ describe Chef::Knife::NodeEditor do
describe "#view" do
it "returns a Hash with only the name, chef_environment, normal, " +
"policy_name, policy_group, and run_list properties" do
- expected = node_data.select do |key,|
- %w{ name chef_environment normal
- policy_name policy_group run_list }.include?(key)
- end
+ expected = node_data.select do |key,|
+ %w{ name chef_environment normal
+ policy_name policy_group run_list }.include?(key)
+ end
- expect(subject.view).to eq(expected)
- end
+ expect(subject.view).to eq(expected)
+ end
context "when config[:all_attributes] == true" do
let(:config) { base_config.merge(all_attributes: true) }
@@ -190,8 +190,8 @@ describe Chef::Knife::NodeEditor do
it "returns an array of property names that doesn't include " +
"the non-editable properties" do
- expect(subject.updated?).to eql %w{ chef_environment normal policy_name policy_group run_list }
- end
+ expect(subject.updated?).to eql %w{ chef_environment normal policy_name policy_group run_list }
+ end
end
end
diff --git a/spec/unit/property/state_spec.rb b/spec/unit/property/state_spec.rb
index ca2cd99214..1283fd2456 100644
--- a/spec/unit/property/state_spec.rb
+++ b/spec/unit/property/state_spec.rb
@@ -257,29 +257,29 @@ describe "Chef::Resource#identity and #state" do
with_property ":x, identity: true, default: 'xxx'",
":y, identity: true, default: 'yyy'",
":z, identity: true, default: 'zzz'" do
- it "identity_property raises an error if multiple identity values are defined" do
- expect { resource_class.identity_property }.to raise_error Chef::Exceptions::MultipleIdentityError
- end
- it "identity_attr raises an error if multiple identity values are defined" do
- expect { resource_class.identity_attr }.to raise_error Chef::Exceptions::MultipleIdentityError
- end
- it "identity returns all identity values in a hash if multiple are defined" do
- resource.x "foo"
- resource.y "bar"
- resource.z "baz"
- expect(resource.identity).to eq(x: "foo", y: "bar", z: "baz")
- end
- it "identity returns all values whether any value is set or not" do
- expect(resource.identity).to eq(x: "xxx", y: "yyy", z: "zzz")
- end
- it "identity_properties wipes out any other identity attributes if multiple are defined" do
- resource_class.identity_properties :y
- resource.x "foo"
- resource.y "bar"
- resource.z "baz"
- expect(resource.identity).to eq "bar"
+ it "identity_property raises an error if multiple identity values are defined" do
+ expect { resource_class.identity_property }.to raise_error Chef::Exceptions::MultipleIdentityError
+ end
+ it "identity_attr raises an error if multiple identity values are defined" do
+ expect { resource_class.identity_attr }.to raise_error Chef::Exceptions::MultipleIdentityError
+ end
+ it "identity returns all identity values in a hash if multiple are defined" do
+ resource.x "foo"
+ resource.y "bar"
+ resource.z "baz"
+ expect(resource.identity).to eq(x: "foo", y: "bar", z: "baz")
+ end
+ it "identity returns all values whether any value is set or not" do
+ expect(resource.identity).to eq(x: "xxx", y: "yyy", z: "zzz")
+ end
+ it "identity_properties wipes out any other identity attributes if multiple are defined" do
+ resource_class.identity_properties :y
+ resource.x "foo"
+ resource.y "bar"
+ resource.z "baz"
+ expect(resource.identity).to eq "bar"
+ end
end
- end
with_property ":x, identity: true, name_property: true" do
it "identity when x is not defined returns the value of x" do
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index 866b548d4e..5e1ffbf208 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -67,18 +67,18 @@ describe Chef::Provider::Mount::Mount do
describe "when dealing with network mounts" do
{ "nfs" => "nfsserver:/vol/path",
"cifs" => "//cifsserver/share" }.each do |type, fs_spec|
- it "should detect network fs_spec (#{type})" do
- @new_resource.device fs_spec
- expect(@provider.network_device?).to be_truthy
+ it "should detect network fs_spec (#{type})" do
+ @new_resource.device fs_spec
+ expect(@provider.network_device?).to be_truthy
+ end
+
+ it "should ignore trailing slash and set mounted to true for network mount (#{type})" do
+ @new_resource.device fs_spec
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{fs_spec}/ on /tmp/foo type #{type} (rw)\n"))
+ @provider.load_current_resource
+ expect(@provider.current_resource.mounted).to be_truthy
+ end
end
-
- it "should ignore trailing slash and set mounted to true for network mount (#{type})" do
- @new_resource.device fs_spec
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{fs_spec}/ on /tmp/foo type #{type} (rw)\n"))
- @provider.load_current_resource
- expect(@provider.current_resource.mounted).to be_truthy
- end
- end
end
it "should raise an error if the mount device does not exist" do
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb
index 61c415f88d..a247c26651 100644
--- a/spec/unit/provider/powershell_script_spec.rb
+++ b/spec/unit/provider/powershell_script_spec.rb
@@ -107,19 +107,19 @@ describe Chef::Provider::PowershellScript, "action_run" do
"3.6" => "Bypass",
"4.0" => "Bypass",
"5.0" => "Bypass" }.each do |version_policy|
- let(:powershell_version) { version_policy[0].to_f }
- context "when running PowerShell version #{version_policy[0]}" do
let(:powershell_version) { version_policy[0].to_f }
-
- it "sets default -ExecutionPolicy flag to '#{version_policy[1]}'" do
- expect(execution_policy_flag.downcase).to eq(version_policy[1].downcase)
- end
- it "sets user defined -ExecutionPolicy flag to 'RemoteSigned'" do
- set_user_defined_flag
- expect(execution_policy_flag.downcase).to eq("RemoteSigned".downcase)
+ context "when running PowerShell version #{version_policy[0]}" do
+ let(:powershell_version) { version_policy[0].to_f }
+
+ it "sets default -ExecutionPolicy flag to '#{version_policy[1]}'" do
+ expect(execution_policy_flag.downcase).to eq(version_policy[1].downcase)
+ end
+ it "sets user defined -ExecutionPolicy flag to 'RemoteSigned'" do
+ set_user_defined_flag
+ expect(execution_policy_flag.downcase).to eq("RemoteSigned".downcase)
+ end
end
end
- end
end
end
end
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 9145a0caf4..8cda32973e 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -357,14 +357,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
# properties that are Strings
%i{binary_path_name load_order_group dependencies run_as_user
display_name description}.each do |attr|
- it "configures service if #{attr} has changed" do
- provider.current_resource.send("#{attr}=", "old value")
- provider.new_resource.send("#{attr}=", "new value")
-
- expect(Win32::Service).to receive(:configure)
- provider.action_configure
- end
- end
+ it "configures service if #{attr} has changed" do
+ provider.current_resource.send("#{attr}=", "old value")
+ provider.new_resource.send("#{attr}=", "new value")
+
+ expect(Win32::Service).to receive(:configure)
+ provider.action_configure
+ end
+ end
# properties that are Integers
%i{service_type error_control}.each do |attr|
diff --git a/spec/unit/resource/windows_service_spec.rb b/spec/unit/resource/windows_service_spec.rb
index 53cf1bc0f8..a416ca0a05 100644
--- a/spec/unit/resource/windows_service_spec.rb
+++ b/spec/unit/resource/windows_service_spec.rb
@@ -84,11 +84,11 @@ describe Chef::Resource::WindowsService, "initialize" do
# Properties that are Strings
%i{description service_name binary_path_name load_order_group dependencies
run_as_user run_as_password display_name}.each do |prop|
- it "support setting #{prop} property with a String" do
- resource.send("#{prop}=", "some value")
- expect(resource.send(prop)).to eq("some value")
- end
- end
+ it "support setting #{prop} property with a String" do
+ resource.send("#{prop}=", "some value")
+ expect(resource.send(prop)).to eq("some value")
+ end
+ end
# Properties that are Integers
%i{desired_access error_control service_type}.each do |prop|