mirror of
https://github.com/inspec/inspec
synced 2024-11-26 14:40:26 +00:00
Merge pull request #249 from chef/schisamo/load-path-fix
ensure all test directories are on the runner $LOAD_PATH
This commit is contained in:
commit
ff16a8ef27
1 changed files with 8 additions and 0 deletions
|
@ -52,6 +52,14 @@ module Inspec
|
|||
tests = items.find_all { |i| i[:type] == :test }
|
||||
libs = items.find_all { |i| i[:type] == :library }
|
||||
|
||||
# Ensure each test directory exists on the $LOAD_PATH. This
|
||||
# will ensure traditional RSpec-isms like `require 'spec_helper'`
|
||||
# continue to work.
|
||||
tests.flatten.each do |test|
|
||||
test_directory = File.dirname(test[:ref])
|
||||
$LOAD_PATH.unshift test_directory unless $LOAD_PATH.include?(test_directory)
|
||||
end
|
||||
|
||||
# add all tests (raw) to the runtime
|
||||
tests.flatten.each do |test|
|
||||
add_content(test, libs)
|
||||
|
|
Loading…
Reference in a new issue