Class: Nitrous::CommandLineTestContext

Inherits:
TestContext show all
Defined in:
lib/nitrous/test_context.rb

Instance Method Summary collapse

Methods inherited from TestContext

create, #exit_status, gui?, #summary, #summary_with_benchmark

Constructor Details

#initialize(test_count) ⇒ CommandLineTestContext

Returns a new instance of CommandLineTestContext.



50
51
52
53
54
# File 'lib/nitrous/test_context.rb', line 50

def initialize(test_count)
  super
  @progress_bar = ProgressBar.new(test_count)
  update_text
end

Instance Method Details

#failed(exception) ⇒ Object



66
67
68
69
# File 'lib/nitrous/test_context.rb', line 66

def failed(exception)
  super
  @progress_bar.color = ProgressBar::RED
end

#finishObject



71
72
73
74
# File 'lib/nitrous/test_context.rb', line 71

def finish
  @progress_bar.text = summary_with_benchmark
  @progress_bar.draw
end

#ran_test(test, result) ⇒ Object



56
57
58
59
60
# File 'lib/nitrous/test_context.rb', line 56

def ran_test(test, result)
  super
  @progress_bar.step
  update_text
end

#update_textObject



62
63
64
# File 'lib/nitrous/test_context.rb', line 62

def update_text
  @progress_bar.text = summary
end