Class: Test::Reporters::Progress
- Inherits:
-
Dotprogress
- Object
- Abstract
- Dotprogress
- Test::Reporters::Progress
- Defined in:
- lib/rubytest/format/progress.rb
Overview
Show completed results and timing without enumerating the suite in advance.
Constant Summary collapse
- SYMBOLS =
{ pass: '.', fail: 'F', error: 'E', todo: 'P', skip: 'S' }.freeze
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
- #begin_case(test_case) ⇒ Object
- #begin_suite(suite) ⇒ Object
- #end_case(test_case) ⇒ Object
- #record(result) ⇒ Object
Methods inherited from Dotprogress
#end_suite, #error, #fail, #finish, #initialize, #pass, #skip_case, #skip_test, #todo
Methods inherited from Abstract
#begin_test, #end_test, inherited, #initialize, registry
Constructor Details
This class inherits a constructor from Test::Reporters::Dotprogress
Instance Method Details
#begin_case(test_case) ⇒ Object
16 17 18 19 |
# File 'lib/rubytest/format/progress.rb', line 16 def begin_case(test_case) @output.puts "#{' ' * @depth}#{test_case.to_s.lines.first.to_s.strip}" @depth += 1 end |
#begin_suite(suite) ⇒ Object
10 11 12 13 14 |
# File 'lib/rubytest/format/progress.rb', line 10 def begin_suite(suite) @completed = 0 @started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC) @depth = 0 end |
#end_case(test_case) ⇒ Object
21 22 23 |
# File 'lib/rubytest/format/progress.rb', line 21 def end_case(test_case) @depth -= 1 end |
#record(result) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/rubytest/format/progress.rb', line 25 def record(result) @completed += 1 elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @started_at depth = result.kind == :case && @depth.positive? ? @depth - 1 : @depth label = "#{' ' * depth}#{result.test.to_s.lines.first.to_s.strip}" @output.puts "%4d %8.3fs %8.5fs %s %s" % [ @completed, elapsed, result.elapsed, SYMBOLS.fetch(result.status), label ] end |