Method: Assert::Config#initialize

Defined in:
lib/assert.rb

#initializeConfig

Returns a new instance of Config.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/assert.rb', line 52

def initialize
  @view   = Assert::View::DefaultView.new($stdout)
  @suite  = Assert::Suite.new
  @runner = Assert::Runner.new
  @test_dir    = "test"
  @test_helper = "helper.rb"

  # use git, by default, to determine which files have changes
  @changed_files = proc do |test_paths|
    cmds = [
      "git diff --no-ext-diff --name-only",       # changed files
      "git ls-files --others --exclude-standard"  # added files
    ]
    cmd = cmds.map{ |c| "#{c} -- #{test_paths.join(' ')}" }.join(' && ')
    puts "  `#{cmd}`" if Assert.config.debug
    `#{cmd}`.split("\n")
  end

  # default option values
  @runner_seed    = begin; srand; srand % 0xFFFF; end.to_i
  @capture_output = false
  @halt_on_fail   = true
  @changed_only   = false
  @debug          = false
end