module RComp::Suite

Public Instance Methods

load(pattern=nil) click to toggle source

Create a test suite

pattern - A pattern to filter the tests that are added to the suite

Returns an Array of Test objects

# File lib/rcomp/suite.rb, line 16
def load(pattern=nil)
  tests = []

  # Find all tests in the tests directory
  Find.find @@conf.test_root do |path|
    # recurse into all subdirectories
    next if File.directory? path

    # filter tests by pattern if present
    if pattern
      next unless rel_path(path).match(pattern)
    end

    # ignore dotfiles
    next if File.basename(path).match(/^\..*/)

    # ignore files in ignore filter
    next if ignored?(path)

    tests << Test.new(path)
  end

  return tests
end

Private Instance Methods

ignored?(path) click to toggle source

Checks all ignore patterns against a given relative path

path - A relative path of a test

Returns true if any patterns match the path, false otherwise

# File lib/rcomp/suite.rb, line 48
def ignored?(path)
  @@conf.ignore.each do |ignore|
    return true if rel_path(path).match(ignore)
  end
  return false
end