summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-11-06 12:16:49 -0800
committerTim Smith <tsmith84@gmail.com>2020-11-06 12:16:49 -0800
commit02534cc032901a9ce3e2fb701dba631dbb364c8e (patch)
tree83c38082e6df51a53e402cfe6769e266529deffe
parent0b5faccd9f852e7f73a58cbba65475343f7109e2 (diff)
downloadchef-02534cc032901a9ce3e2fb701dba631dbb364c8e.tar.gz
Collapse more duplicate branches
Simplify more case statements Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/provider/cron.rb7
-rw-r--r--lib/chef/resource_collection/resource_set.rb6
-rw-r--r--spec/functional/resource/apt_package_spec.rb4
3 files changed, 3 insertions, 14 deletions
diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb
index b7aa6dc3fc..7d37f34b1a 100644
--- a/lib/chef/provider/cron.rb
+++ b/lib/chef/provider/cron.rb
@@ -157,12 +157,7 @@ class Chef
next
when ENV_PATTERN
next if cron_found
- when SPECIAL_PATTERN
- if cron_found
- cron_found = false
- next
- end
- when CRON_PATTERN
+ when SPECIAL_PATTERN, CRON_PATTERN
if cron_found
cron_found = false
next
diff --git a/lib/chef/resource_collection/resource_set.rb b/lib/chef/resource_collection/resource_set.rb
index 5221f5c4a2..db298afb63 100644
--- a/lib/chef/resource_collection/resource_set.rb
+++ b/lib/chef/resource_collection/resource_set.rb
@@ -123,11 +123,7 @@ class Chef
# * Chef::Exceptions::InvalidResourceSpecification for all invalid input.
def validate_lookup_spec!(query_object)
case query_object
- when Chef::Resource
- true
- when SINGLE_RESOURCE_MATCH, MULTIPLE_RESOURCE_MATCH, NAMELESS_RESOURCE_MATCH
- true
- when Hash
+ when Chef::Resource, SINGLE_RESOURCE_MATCH, MULTIPLE_RESOURCE_MATCH, NAMELESS_RESOURCE_MATCH, Hash
true
when String
raise Chef::Exceptions::InvalidResourceSpecification,
diff --git a/spec/functional/resource/apt_package_spec.rb b/spec/functional/resource/apt_package_spec.rb
index 6a1031feb8..9f10e27731 100644
--- a/spec/functional/resource/apt_package_spec.rb
+++ b/spec/functional/resource/apt_package_spec.rb
@@ -39,9 +39,7 @@ module AptServer
def tcp_test_port(hostname, port)
tcp_socket = TCPSocket.new(hostname, port)
true
- rescue Errno::ETIMEDOUT
- false
- rescue Errno::ECONNREFUSED
+ rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED
false
ensure
tcp_socket && tcp_socket.close