diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-03 13:11:13 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-05 12:41:04 -0700 |
commit | 9802d7c075c8b7dae42dbcecd92d492f7fa128ac (patch) | |
tree | 0d13de92dc631081f9bcdaddedd6294051e3423b /spec | |
parent | 4978a9a8a402477f3b35f43404701d6a5cf26fa1 (diff) | |
download | chef-9802d7c075c8b7dae42dbcecd92d492f7fa128ac.tar.gz |
Style/NegatedIf
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/resource/group_spec.rb | 4 | ||||
-rw-r--r-- | spec/functional/run_lock_spec.rb | 4 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 | ||||
-rw-r--r-- | spec/support/lib/chef/resource/zen_follower.rb | 2 | ||||
-rw-r--r-- | spec/support/lib/chef/resource/zen_master.rb | 2 | ||||
-rw-r--r-- | spec/support/platforms/win32/spec_service.rb | 2 | ||||
-rw-r--r-- | spec/support/shared/integration/knife_support.rb | 8 | ||||
-rw-r--r-- | spec/support/shared/unit/file_system_support.rb | 2 | ||||
-rw-r--r-- | spec/unit/mixin/windows_architecture_helper_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/powershell_script_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider_resolver_spec.rb | 4 |
11 files changed, 17 insertions, 17 deletions
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb index 343e4f2f4e..f5bb458666 100644 --- a/spec/functional/resource/group_spec.rb +++ b/spec/functional/resource/group_spec.rb @@ -96,7 +96,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do end def create_user(username, uid = nil) - if ! windows_domain_user?(username) + unless windows_domain_user?(username) user_to_create = user(username) user_to_create.uid(uid) if uid user_to_create.run_action(:create) @@ -105,7 +105,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do end def remove_user(username) - if ! windows_domain_user?(username) + unless windows_domain_user?(username) u = user(username) u.manage_home false # jekins hosts throw mail spool file not owned by user if we use manage_home true u.run_action(:remove) diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb index 825f2810d4..d9a8bd2d0e 100644 --- a/spec/functional/run_lock_spec.rb +++ b/spec/functional/run_lock_spec.rb @@ -347,7 +347,7 @@ describe Chef::RunLock do example.log_event("#{name}.run_to(#{to_event.inspect})") # Start the process if it's not started - start if !pid + start unless pid # Tell the process what to stop at (also means it can go) write_to_process.print "#{to_event}\n" @@ -371,7 +371,7 @@ describe Chef::RunLock do def run_to_completion example.log_event("#{name}.run_to_completion") # Start the process if it's not started - start if !pid + start unless pid # Tell the process to stop at nothing (no blocking) @write_to_process.print "nothing\n" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ac5f68b484..ee486e919c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -145,7 +145,7 @@ RSpec.configure do |config| config.filter_run_excluding windows_only: true unless windows? config.filter_run_excluding not_supported_on_windows: true if windows? config.filter_run_excluding not_supported_on_macos: true if mac_osx? - config.filter_run_excluding macos_only: true if !mac_osx? + config.filter_run_excluding macos_only: true unless mac_osx? config.filter_run_excluding not_supported_on_aix: true if aix? config.filter_run_excluding not_supported_on_solaris: true if solaris? config.filter_run_excluding not_supported_on_gce: true if gce? diff --git a/spec/support/lib/chef/resource/zen_follower.rb b/spec/support/lib/chef/resource/zen_follower.rb index 84fc71cc99..72dd67ca97 100644 --- a/spec/support/lib/chef/resource/zen_follower.rb +++ b/spec/support/lib/chef/resource/zen_follower.rb @@ -25,7 +25,7 @@ class Chef provides :follower, platform: "zen" def master(arg = nil) - if !arg.nil? + unless arg.nil? @master = arg end @master diff --git a/spec/support/lib/chef/resource/zen_master.rb b/spec/support/lib/chef/resource/zen_master.rb index 9d6e5d46f7..710742a285 100644 --- a/spec/support/lib/chef/resource/zen_master.rb +++ b/spec/support/lib/chef/resource/zen_master.rb @@ -30,7 +30,7 @@ class Chef end def something(arg = nil) - if !arg.nil? + unless arg.nil? @something = arg end @something diff --git a/spec/support/platforms/win32/spec_service.rb b/spec/support/platforms/win32/spec_service.rb index 5b30c567cc..7398cfbd96 100644 --- a/spec/support/platforms/win32/spec_service.rb +++ b/spec/support/platforms/win32/spec_service.rb @@ -25,7 +25,7 @@ class SpecService < ::Win32::Daemon def service_main(*startup_parameters) while running? - if !File.exists?(@test_service_file) + unless File.exists?(@test_service_file) File.open(@test_service_file, "wb") do |f| f.write("This file is created by SpecService") end diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb index 87ce1bc0b0..56933537f0 100644 --- a/spec/support/shared/integration/knife_support.rb +++ b/spec/support/shared/integration/knife_support.rb @@ -150,7 +150,7 @@ module KnifeSupport expected[:stderr] = arg end end - expected[:exit_code] = 1 if !expected[:exit_code] + expected[:exit_code] = 1 unless expected[:exit_code] should_result_in(expected) end @@ -169,9 +169,9 @@ module KnifeSupport private def should_result_in(expected) - expected[:stdout] = "" if !expected[:stdout] - expected[:stderr] = "" if !expected[:stderr] - expected[:exit_code] = 0 if !expected[:exit_code] + expected[:stdout] = "" unless expected[:stdout] + expected[:stderr] = "" unless expected[:stderr] + expected[:exit_code] = 0 unless expected[:exit_code] # TODO make this go away stderr_actual = @stderr.sub(/^WARNING: No knife configuration file found\n/, "") diff --git a/spec/support/shared/unit/file_system_support.rb b/spec/support/shared/unit/file_system_support.rb index 80cc7cdc23..957479f149 100644 --- a/spec/support/shared/unit/file_system_support.rb +++ b/spec/support/shared/unit/file_system_support.rb @@ -23,7 +23,7 @@ require "chef/chef_fs/file_system/memory/memory_file" module FileSystemSupport def memory_fs(pretty_name, value, cannot_be_in_regex = nil) - if !value.is_a?(Hash) + unless value.is_a?(Hash) raise "memory_fs() must take a Hash" end diff --git a/spec/unit/mixin/windows_architecture_helper_spec.rb b/spec/unit/mixin/windows_architecture_helper_spec.rb index 7d4e18d23c..ad7bee0ec9 100644 --- a/spec/unit/mixin/windows_architecture_helper_spec.rb +++ b/spec/unit/mixin/windows_architecture_helper_spec.rb @@ -67,7 +67,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do it "returns true only when forced_32bit_override_required? has 64-bit node architecture and 32-bit desired architecture" do with_node_architecture_combinations do |node, desired_arch| expect(forced_32bit_override_required?(node, desired_arch)).to be true if (node_windows_architecture(node) == :x86_64) && (desired_arch == :i386) && !is_i386_process_on_x86_64_windows? - expect(forced_32bit_override_required?(node, desired_arch)).to be false if ! ((node_windows_architecture(node) == :x86_64) && (desired_arch == :i386)) + expect(forced_32bit_override_required?(node, desired_arch)).to be false unless (node_windows_architecture(node) == :x86_64) && (desired_arch == :i386) end end diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb index be4df761d2..cca0f34067 100644 --- a/spec/unit/provider/powershell_script_spec.rb +++ b/spec/unit/provider/powershell_script_spec.rb @@ -24,7 +24,7 @@ describe Chef::Provider::PowershellScript, "action_run" do node = Chef::Node.new node.default["kernel"] = {} node.default["kernel"][:machine] = :x86_64.to_s - if ! powershell_version.nil? + unless powershell_version.nil? node.default[:languages] = { powershell: { version: powershell_version } } end node diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb index 9014b873de..94e0d6074b 100644 --- a/spec/unit/provider_resolver_spec.rb +++ b/spec/unit/provider_resolver_spec.rb @@ -869,7 +869,7 @@ describe Chef::ProviderResolver do def self.create_provider_tests(providers, test, expected, filter) expected = expected.merge(providers.select { |key, value| key.is_a?(Symbol) }) providers.each do |key, value| - if !key.is_a?(Symbol) + unless key.is_a?(Symbol) next_test = test.merge({ filter => key }) next_filter = case filter @@ -888,7 +888,7 @@ describe Chef::ProviderResolver do end end # If there is no filter, we're as deep as we need to go - if !filter + unless filter on_platform test.delete(:platform), test do expect_providers(expected) end |