Module: DohTest

Defined in:
lib/doh/test/failure.rb,
lib/doh/test/configure.rb,
lib/doh/test/assertions.rb,
lib/doh/test/test_group.rb,
lib/doh/test/group_runner.rb,
lib/doh/test/master_runner.rb,
lib/doh/test/require_paths.rb,
lib/doh/test/stream_output.rb,
lib/doh/test/capture_output.rb,
lib/doh/test/backtrace_parser.rb

Defined Under Namespace

Classes: BacktraceParser, CaptureOutput, Failure, GroupRunner, MasterRunner, StreamOutput, TestGroup

Class Method Summary collapse

Class Method Details

.add_default_config_valuesObject



25
26
27
28
# File 'lib/doh/test/configure.rb', line 25

def self.add_default_config_values
  DohTest::config[:glob] ||= '*.dt.rb'
  DohTest::config[:seed] ||= (Time.new.to_f * 1000).to_i
end

.backtrace_summary(excpt) ⇒ Object



60
61
62
# File 'lib/doh/test/backtrace_parser.rb', line 60

def self.backtrace_summary(excpt)
  BacktraceParser.new(excpt.backtrace).summary
end

.configObject



5
6
7
# File 'lib/doh/test/configure.rb', line 5

def self.config
  @config ||= {}
end

.configure(start_path) ⇒ Object



30
31
32
33
# File 'lib/doh/test/configure.rb', line 30

def self.configure(start_path)
  load_configuration_files(start_path)
  add_default_config_values
end

.load_configuration_files(start_path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/doh/test/configure.rb', line 9

def self.load_configuration_files(start_path)
  start_directory = File.dirname(start_path)
  root_directory = Doh::find_root(start_directory)

  local_filename = Doh::findup(start_directory, 'configure_dohtest.rb')
  if local_filename && File.exist?(local_filename)
    require(local_filename)
    return
  end

  if root_directory
    root_filename = File.join(root_directory, 'config', 'dohtest.rb')
    require(root_filename) if File.exist?(root_filename)
  end
end

.require_paths(glob, paths) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/doh/test/require_paths.rb', line 3

def self.require_paths(glob, paths)
  paths.collect {|elem| File.expand_path(elem) }.each do |onepath|
    if File.directory?(onepath)
      Dir.glob(File.join(onepath, '**', glob)).each {|filename| require(filename)}
    else
      require(File.expand_path(onepath))
    end
  end
end