summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-03 13:11:13 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-05 12:41:04 -0700
commit9802d7c075c8b7dae42dbcecd92d492f7fa128ac (patch)
tree0d13de92dc631081f9bcdaddedd6294051e3423b /spec/support
parent4978a9a8a402477f3b35f43404701d6a5cf26fa1 (diff)
downloadchef-9802d7c075c8b7dae42dbcecd92d492f7fa128ac.tar.gz
Style/NegatedIf
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/lib/chef/resource/zen_follower.rb2
-rw-r--r--spec/support/lib/chef/resource/zen_master.rb2
-rw-r--r--spec/support/platforms/win32/spec_service.rb2
-rw-r--r--spec/support/shared/integration/knife_support.rb8
-rw-r--r--spec/support/shared/unit/file_system_support.rb2
5 files changed, 8 insertions, 8 deletions
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