Class: ProbeDockRSpec::Formatter
- Inherits:
-
Object
- Object
- ProbeDockRSpec::Formatter
- Defined in:
- lib/probe_dock_rspec/formatter.rb
Instance Method Summary collapse
- #close(notification) ⇒ Object
- #example_failed(example_notification) ⇒ Object
- #example_group_finished(group_notification) ⇒ Object
- #example_group_started(group_notification) ⇒ Object
- #example_passed(example_notification) ⇒ Object
- #example_started(example_notification) ⇒ Object
-
#initialize(output) ⇒ Formatter
constructor
A new instance of Formatter.
- #start(notification) ⇒ Object
- #stop(notification) ⇒ Object
Constructor Details
#initialize(output) ⇒ Formatter
Returns a new instance of Formatter.
12 13 14 15 16 17 18 19 |
# File 'lib/probe_dock_rspec/formatter.rb', line 12 def initialize output config = ProbeDockRSpec.config @client = ProbeDockProbe::Client.new config.server, config. @test_run = ProbeDockProbe::TestRun.new config.project @groups = [] end |
Instance Method Details
#close(notification) ⇒ Object
50 51 52 |
# File 'lib/probe_dock_rspec/formatter.rb', line 50 def close notification @client.process @test_run end |
#example_failed(example_notification) ⇒ Object
41 42 43 |
# File 'lib/probe_dock_rspec/formatter.rb', line 41 def example_failed example_notification add_result example_notification, false end |
#example_group_finished(group_notification) ⇒ Object
29 30 31 |
# File 'lib/probe_dock_rspec/formatter.rb', line 29 def example_group_finished group_notification @groups.pop end |
#example_group_started(group_notification) ⇒ Object
25 26 27 |
# File 'lib/probe_dock_rspec/formatter.rb', line 25 def example_group_started group_notification @groups << group_notification.group end |
#example_passed(example_notification) ⇒ Object
37 38 39 |
# File 'lib/probe_dock_rspec/formatter.rb', line 37 def example_passed example_notification add_result example_notification, true end |
#example_started(example_notification) ⇒ Object
33 34 35 |
# File 'lib/probe_dock_rspec/formatter.rb', line 33 def example_started example_notification @current_time = Time.now end |
#start(notification) ⇒ Object
21 22 23 |
# File 'lib/probe_dock_rspec/formatter.rb', line 21 def start notification @start_time = Time.now end |
#stop(notification) ⇒ Object
45 46 47 48 |
# File 'lib/probe_dock_rspec/formatter.rb', line 45 def stop notification end_time = Time.now @test_run.duration = ((end_time - @start_time) * 1000).round end |