Method: Inspec::DSL.get_spec_files_for_profile

Defined in:
lib/inspec/dsl.rb

.get_spec_files_for_profile(id) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/inspec/dsl.rb', line 115

def self.get_spec_files_for_profile(id)
  base_path = '/etc/inspec/tests'
  path = File.join(base_path, id)
  # find all files to be included
  files = []
  if File.directory? path
    # include all library paths, if they exist
    libdir = File.join(path, 'lib')
    if File.directory? libdir and !$LOAD_PATH.include?(libdir)
      $LOAD_PATH.unshift(libdir)
    end
    files = Dir[File.join(path, 'spec', '*_spec.rb')]
  end
  files
end