1 Object.flet(:at_exit => lambda {}) do
2 # keep miniunit's at_exit block from running
3 gem 'miniunit', ">= 1.1.0"
9 # Puke failures/errors in a bucket
11 TestUnitBackend.failure_bucket(*args)
17 # Backend for gathering test results. Instead of ntalbott's test/unit
18 # which ships with Ruby as of 1.8.6, this uses miniunit, a vastly
19 # simpler mostly-compatible replacement.
21 class TestUnitBackend < Backend
23 # Kicks off a miniunit run and captures the failures
28 load(find_test_for(file))
29 # this will call record_failure as needed
30 with_no_output { Test::Unit.autotest }
34 def failure_bucket(klass, method, exception)
35 # FIXME: errors here could actually occur in impl rather than test file
36 color = Test::Assertion === exception ? 'red' : 'yellow'
37 line = exception.backtrace.grep(Regexp.new(@file))[0].match(/:(\d*):/)[1].to_i
39 (@layers[@file] ||= []) << Layer.new(line, color, exception.message, self, @file)
42 # This should allow us to augment a test by running its associated
44 def find_test_for(file)
45 # TODO: return test for implementation if possible
50 Augment::BACKENDS['test'] = self