Class: TestUnitBackend
- Defined in:
- lib/backends/test_unit_backend.rb
Overview
Backend for gathering test results. Instead of ntalbott’s test/unit which ships with Ruby as of 1.8.6, this uses miniunit, a vastly simpler mostly-compatible replacement.
Class Method Summary collapse
- .failure_bucket(klass, method, exception) ⇒ Object
-
.find_test_for(file) ⇒ Object
This should allow us to augment a test by running its associated implementation.
-
.run(file) ⇒ Object
Kicks off a miniunit run and captures the failures.
Methods inherited from Backend
Class Method Details
.failure_bucket(klass, method, exception) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/backends/test_unit_backend.rb', line 34 def failure_bucket(klass, method, exception) # FIXME: errors here could actually occur in impl rather than test file color = Test::Assertion === exception ? 'red' : 'yellow' line = exception.backtrace.grep(Regexp.new(@file))[0].match(/:(\d*):/)[1].to_i (@layers[@file] ||= []) << Layer.new(line, color, exception., self, @file) end |
.find_test_for(file) ⇒ Object
This should allow us to augment a test by running its associated implementation
44 45 46 47 |
# File 'lib/backends/test_unit_backend.rb', line 44 def find_test_for(file) # TODO: return test for implementation if possible file end |
.run(file) ⇒ Object
Kicks off a miniunit run and captures the failures
24 25 26 27 28 29 30 31 32 |
# File 'lib/backends/test_unit_backend.rb', line 24 def run(file) @file = file @layers = {} load(find_test_for(file)) # this will call record_failure as needed with_no_output { Test::Unit.autotest } write_layers end |