Class: Ruptr::Progress::StatusLine
- Inherits:
-
Ruptr::Progress
- Object
- Ruptr::Progress
- Ruptr::Progress::StatusLine
- Defined in:
- lib/ruptr/progress.rb
Constant Summary collapse
- CHARS =
%w[\\ | / -].freeze
Instance Method Summary collapse
Methods inherited from Ruptr::Progress
#begin_plan, #finish_element, #finish_plan, #initialize
Methods included from Sink
#begin_case, #begin_group, #begin_plan, #finish_case, #finish_group, #finish_plan, #submit_case, #submit_group, #submit_plan
Constructor Details
This class inherits a constructor from Ruptr::Progress
Instance Method Details
#progress_end ⇒ Object
92 93 94 95 |
# File 'lib/ruptr/progress.rb', line 92 def progress_end n = @last_line_width @output << ("\b" * n + ' ' * (n + 1) + "\b" * (n + 1)) end |
#progress_result(te, tr) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ruptr/progress.rb', line 51 def progress_result(te, tr) @processor_time += tr.processor_time || 0 @assertions += tr.assertions || 0 if te.test_case? @test_cases += 1 @passed += 1 if tr.passed? @skipped += 1 if tr.skipped? @failed += 1 if tr.failed? @blocked += 1 if tr.blocked? end line = +"\r" line << "Running tests... " if (@processor_time - @last_twirl_processor_time) >= 0.25 @twirls += 1 @last_twirl_processor_time = @processor_time end line << CHARS[@twirls % CHARS.size] line << " ptime:" << colorize('%.03fs' % @processor_time, color: :cyan) line << " cases:" << colorize(@test_cases.to_s, color: :cyan) if (n = @planned_test_case_count) line << "/#{n}" line << " (#{@test_cases * 100 / n}%)" unless n.zero? end line << " asserts:" << colorize(@assertions.to_s, color: :cyan) unless @assertions.zero? line << " passed:" << colorize(@passed.to_s, color: :green) unless @passed.zero? line << " skipped:" << colorize(@skipped.to_s, color: :yellow) unless @skipped.zero? line << " failed:" << colorize(@failed.to_s, color: :red) unless @failed.zero? line << " blocked:" << colorize(@blocked.to_s, color: :magenta) unless @blocked.zero? line << ' ' width = line.length - 1 if width < @last_line_width n = @last_line_width - width + 1 @last_line_width = width line << ' ' * n << "\b" * n else @last_line_width = width end @output << line end |
#progress_start ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/ruptr/progress.rb', line 39 def progress_start @processor_time = 0 @test_cases = @assertions = 0 @passed = @skipped = @failed = @blocked = 0 @last_line_width = 0 @twirls = @last_twirl_processor_time = 0 end |