Module: MiniTest

Defined in:
lib/minitest/mock.rb,
lib/minitest/unit.rb

Overview

Minimal (mostly drop-in) replacement for test-unit.

:include: README.txt

Defined Under Namespace

Modules: Assertions, Expectations Classes: Assertion, Mock, Skip, Spec, Unit

Class Method Summary collapse

Class Method Details

.const_missing(name) ⇒ Object

:nodoc:



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/minitest/unit.rb', line 11

def self.const_missing name # :nodoc:
  case name
  when :MINI_DIR then
    msg = "MiniTest::MINI_DIR was removed. Don't violate other's internals."
    warn "WAR\NING: #{msg}"
    warn "WAR\NING: Used by #{caller.first}."
    const_set :MINI_DIR, "bad value"
  else
    super
  end
end

.filter_backtrace(bt) ⇒ Object

:nodoc:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/minitest/unit.rb', line 33

def self.filter_backtrace bt # :nodoc:
  return ["No backtrace"] unless bt

  new_bt = []

  unless $DEBUG then
    bt.each do |line|
      break if line =~ /lib\/minitest/
      new_bt << line
    end

    new_bt = bt.reject { |line| line =~ /lib\/minitest/ } if new_bt.empty?
    new_bt = bt.dup if new_bt.empty?
  else
    new_bt = bt.dup
  end

  new_bt
end