Skip to content

Commit 1c06f6d

Browse files
committed
(CONT-517) Fix undefined method reverse
Prior to this commit `items.find_all.last` had been repaced by `items.reverse.find`. The change was introduced due to a Rubocop suggestion. However, it was incorrect due to the datatype of `items`. This commit reverts the change.
1 parent 8b97092 commit 1c06f6d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/puppetlabs_spec_helper/tasks/fixtures.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,9 @@ def download_items(items)
317317
end
318318
else
319319
# the last thread started should be the longest wait
320-
item, item_opts = items.reverse.find { |_i, o| o.key?(:thread) }
320+
# Rubocop seems to push towards using select here.. however the implementation today relies on the result being
321+
# an array. Select returns a hash which makes it unsuitable so we need to use find_all.last.
322+
item, item_opts = items.find_all { |_i, o| o.key?(:thread) }.last # rubocop:disable Performance/Detect, Style/CollectionMethods
321323
logger.debug "Waiting on #{item}"
322324
item_opts[:thread].join # wait for the thread to finish
323325
# now that we waited lets try again

0 commit comments

Comments
 (0)