Module: TestBench::Bootstrap::Run

Defined in:
lib/test_bench/bootstrap.rb

Class Method Summary collapse

Class Method Details

.call(paths = nil, exclude_pattern: nil) ⇒ Object



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/test_bench/bootstrap.rb', line 266

def self.call(paths=nil, exclude_pattern: nil)
  paths ||= []
  exclude_pattern ||= Defaults.exclude_file_pattern

  if paths.is_a?(String)
    paths = [paths]
  end

  if paths.empty?
    paths << Defaults.tests_dir
  end

  paths.each do |path|
    Path.search(path, '*.rb', exclude_pattern).each do |file|
      Output.write "Running #{file}"

      begin
        load(file)
      ensure
        Output.newline
      end
    end
  end
end