Skip to content

Commit

Permalink
Skip non-existing paths in $MODULEPATH silently
Browse files Browse the repository at this point in the history
In `map`, a `next` will leave a `nil` value in the array.  This is a
problem since `FileTest.directory? nil` raises "TypeError: no implicit
conversion of nil into String"

Bug was introduced in v4.0.1, in commit b6bfd6f
  • Loading branch information
kjetilho committed Dec 10, 2023
1 parent 66ceded commit b0e420c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/puppetlabs_spec_helper/module_spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def verify_contents(subject, title, expected_lines)
next unless Dir.exist? dir

Dir.entries(dir).grep_v(/^\./).map { |f| File.join(dir, f, 'spec', 'lib') }
end
end.reject do |e| e.nil? end
components.flatten.each do |d|
$LOAD_PATH << d if FileTest.directory?(d) && !$LOAD_PATH.include?(d)
end
Expand Down

0 comments on commit b0e420c

Please sign in to comment.