Class: MicroTest::TestCase

Inherits:
World
  • Object
show all
Defined in:
lib/microtest.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Assertions

#assert, #assert_block, #assert_equal, #assert_in_delta, #assert_instance_of, #assert_kind_of, #assert_match, #assert_nil, #assert_no_match, #assert_not_equal, #assert_not_nil, #assert_not_same, #assert_operator, #assert_raises, #assert_respond_to, #assert_same, #assert_send, #assert_throws, #flunk

Class Method Details

.inherited(subclass) ⇒ Object



21
22
23
# File 'lib/microtest.rb', line 21

def self.inherited(subclass)
  subclass.new
end

.new(*a, &b) ⇒ Object



26
27
28
# File 'lib/microtest.rb', line 26

def self.new(*a,&b)
  $TEST_SUITE << super(*a,&b)
end

Instance Method Details

#call(&cont) ⇒ Object



36
37
38
39
40
# File 'lib/microtest.rb', line 36

def call(&cont)
  setup
  cont.call
  teardown
end

#eachObject



43
44
45
46
47
48
# File 'lib/microtest.rb', line 43

def each
  methods.each do |m|
    next unless m.to_s.start_with?('test_')
    yield(TestMethod.new(method(m)))
  end
end

#setupObject



51
52
# File 'lib/microtest.rb', line 51

def setup
end

#teardownObject



55
56
# File 'lib/microtest.rb', line 55

def teardown
end

#to_sObject



31
32
33
# File 'lib/microtest.rb', line 31

def to_s
  self.class.name
end