Skip to content

Commit c3c8171

Browse files
committed
Skip non-existing paths in $MODULEPATH silently
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
1 parent 66ceded commit c3c8171

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/puppetlabs_spec_helper/module_spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def verify_contents(subject, title, expected_lines)
5858

5959
Dir.entries(dir).grep_v(/^\./).map { |f| File.join(dir, f, 'spec', 'lib') }
6060
end
61-
components.flatten.each do |d|
61+
components.compact.flatten.each do |d|
6262
$LOAD_PATH << d if FileTest.directory?(d) && !$LOAD_PATH.include?(d)
6363
end
6464

0 commit comments

Comments
 (0)