Class: RoxClient::RSpec::Formatter
- Inherits:
-
RSpec::Core::Formatters::BaseFormatter
- Object
- RSpec::Core::Formatters::BaseFormatter
- RoxClient::RSpec::Formatter
- Defined in:
- lib/rox-client-rspec/formatter.rb
Instance Method Summary collapse
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
- #example_failed(example) ⇒ Object
- #example_group_finished(group) ⇒ Object
- #example_group_started(group) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_started(example) ⇒ Object
-
#initialize(*args) ⇒ Formatter
constructor
A new instance of Formatter.
- #start(example_count) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(*args) ⇒ Formatter
9 10 11 12 13 14 15 16 17 |
# File 'lib/rox-client-rspec/formatter.rb', line 9 def initialize *args super *args config = RoxClient::RSpec.config @client = Client.new config.server, config. @test_run = TestRun.new config.project @groups = [] end |
Instance Method Details
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
50 51 52 |
# File 'lib/rox-client-rspec/formatter.rb', line 50 def dump_summary duration, example_count, failure_count, pending_count @client.process @test_run end |
#example_failed(example) ⇒ Object
40 41 42 |
# File 'lib/rox-client-rspec/formatter.rb', line 40 def example_failed example add_result example, false end |
#example_group_finished(group) ⇒ Object
28 29 30 |
# File 'lib/rox-client-rspec/formatter.rb', line 28 def example_group_finished group @groups.pop end |
#example_group_started(group) ⇒ Object
24 25 26 |
# File 'lib/rox-client-rspec/formatter.rb', line 24 def example_group_started group @groups << group end |
#example_passed(example) ⇒ Object
36 37 38 |
# File 'lib/rox-client-rspec/formatter.rb', line 36 def example_passed example add_result example, true end |
#example_started(example) ⇒ Object
32 33 34 |
# File 'lib/rox-client-rspec/formatter.rb', line 32 def example_started example @current_time = Time.now end |
#start(example_count) ⇒ Object
19 20 21 22 |
# File 'lib/rox-client-rspec/formatter.rb', line 19 def start example_count # TODO: measure milliseconds @start_time = Time.now end |
#stop ⇒ Object
44 45 46 47 48 |
# File 'lib/rox-client-rspec/formatter.rb', line 44 def stop end_time = Time.now @test_run.end_time = end_time.to_i * 1000 @test_run.duration = ((end_time - @start_time) * 1000).round end |