Module: DohTest

Defined in:
lib/dohtest/failure.rb,
lib/dohtest/configure.rb,
lib/dohtest/assertions.rb,
lib/dohtest/test_group.rb,
lib/dohtest/group_runner.rb,
lib/dohtest/master_runner.rb,
lib/dohtest/require_paths.rb,
lib/dohtest/stream_output.rb,
lib/dohtest/capture_output.rb,
lib/dohtest/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



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

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/dohtest/backtrace_parser.rb', line 60

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

.configObject



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

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

.configure(start_path) ⇒ Object



35
36
37
38
# File 'lib/dohtest/configure.rb', line 35

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
24
25
26
27
28
# File 'lib/dohtest/configure.rb', line 9

def self.load_configuration_files(start_path)
  start_path = File.expand_path(start_path)
  if File.directory?(start_path)
    start_directory = start_path
  else
    start_directory = File.dirname(start_path)
  end
  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/dohtest/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