Class: RSpec::Conductor::SuiteRun
- Inherits:
-
Object
- Object
- RSpec::Conductor::SuiteRun
- Defined in:
- lib/rspec/conductor/suite_run.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#example_stats ⇒ Object
Returns the value of attribute example_stats.
-
#examples_failed ⇒ Object
Returns the value of attribute examples_failed.
-
#examples_passed ⇒ Object
Returns the value of attribute examples_passed.
-
#examples_pending ⇒ Object
Returns the value of attribute examples_pending.
-
#spec_files_processed ⇒ Object
Returns the value of attribute spec_files_processed.
-
#spec_files_total ⇒ Object
Returns the value of attribute spec_files_total.
-
#started_at ⇒ Object
Returns the value of attribute started_at.
-
#worker_crashes ⇒ Object
Returns the value of attribute worker_crashes.
Instance Method Summary collapse
- #example_failed(message) ⇒ Object
- #example_filtered(message) ⇒ Object
- #example_passed(message) ⇒ Object
- #example_pending(message) ⇒ Object
-
#initialize ⇒ SuiteRun
constructor
A new instance of SuiteRun.
- #spec_file_assigned ⇒ Object
- #spec_file_complete ⇒ Object
- #spec_file_error(message) ⇒ Object
- #spec_file_processed_percentage ⇒ Object
- #specs_runtime ⇒ Object
- #success? ⇒ Boolean
- #suite_complete ⇒ Object
- #total_runtime ⇒ Object
- #worker_crashed ⇒ Object
Constructor Details
#initialize ⇒ SuiteRun
Returns a new instance of SuiteRun.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rspec/conductor/suite_run.rb', line 8 def initialize @examples_passed = 0 @examples_failed = 0 @examples_pending = 0 @worker_crashes = 0 @errors = [] @started_at = Time.now @specs_started_at = nil @specs_completed_at = nil @spec_files_total = 0 @spec_files_processed = 0 @example_stats = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def errors @errors end |
#example_stats ⇒ Object
Returns the value of attribute example_stats.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def example_stats @example_stats end |
#examples_failed ⇒ Object
Returns the value of attribute examples_failed.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def examples_failed @examples_failed end |
#examples_passed ⇒ Object
Returns the value of attribute examples_passed.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def examples_passed @examples_passed end |
#examples_pending ⇒ Object
Returns the value of attribute examples_pending.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def examples_pending @examples_pending end |
#spec_files_processed ⇒ Object
Returns the value of attribute spec_files_processed.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def spec_files_processed @spec_files_processed end |
#spec_files_total ⇒ Object
Returns the value of attribute spec_files_total.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def spec_files_total @spec_files_total end |
#started_at ⇒ Object
Returns the value of attribute started_at.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def started_at @started_at end |
#worker_crashes ⇒ Object
Returns the value of attribute worker_crashes.
6 7 8 |
# File 'lib/rspec/conductor/suite_run.rb', line 6 def worker_crashes @worker_crashes end |
Instance Method Details
#example_failed(message) ⇒ Object
31 32 33 34 35 |
# File 'lib/rspec/conductor/suite_run.rb', line 31 def example_failed() @example_stats << .slice(:id, :location, :run_time, :description).merge(status: "failed") @examples_failed += 1 @errors << end |
#example_filtered(message) ⇒ Object
42 43 44 |
# File 'lib/rspec/conductor/suite_run.rb', line 42 def example_filtered() @example_stats << .slice(:id, :location).merge(status: nil) end |
#example_passed(message) ⇒ Object
26 27 28 29 |
# File 'lib/rspec/conductor/suite_run.rb', line 26 def example_passed() @example_stats << .slice(:id, :location, :run_time, :description).merge(status: "passed") @examples_passed += 1 end |
#example_pending(message) ⇒ Object
37 38 39 40 |
# File 'lib/rspec/conductor/suite_run.rb', line 37 def example_pending() @example_stats << .slice(:id, :location).merge(status: "pending") @examples_pending += 1 end |
#spec_file_assigned ⇒ Object
46 47 48 |
# File 'lib/rspec/conductor/suite_run.rb', line 46 def spec_file_assigned @specs_started_at ||= Time.now end |
#spec_file_complete ⇒ Object
50 51 52 |
# File 'lib/rspec/conductor/suite_run.rb', line 50 def spec_file_complete @spec_files_processed += 1 end |
#spec_file_error(message) ⇒ Object
54 55 56 |
# File 'lib/rspec/conductor/suite_run.rb', line 54 def spec_file_error() @errors << end |
#spec_file_processed_percentage ⇒ Object
58 59 60 61 62 |
# File 'lib/rspec/conductor/suite_run.rb', line 58 def spec_file_processed_percentage return 0.0 if @spec_files_total.zero? @spec_files_processed.to_f / @spec_files_total end |
#specs_runtime ⇒ Object
72 73 74 |
# File 'lib/rspec/conductor/suite_run.rb', line 72 def specs_runtime ((@specs_completed_at || Time.now) - (@specs_started_at || @started_at)).to_f end |
#success? ⇒ Boolean
22 23 24 |
# File 'lib/rspec/conductor/suite_run.rb', line 22 def success? @examples_failed.zero? && @errors.empty? && @worker_crashes.zero? && @spec_files_total == @spec_files_processed end |
#suite_complete ⇒ Object
68 69 70 |
# File 'lib/rspec/conductor/suite_run.rb', line 68 def suite_complete @specs_completed_at ||= Time.now end |
#total_runtime ⇒ Object
76 77 78 |
# File 'lib/rspec/conductor/suite_run.rb', line 76 def total_runtime ((@specs_completed_at || Time.now) - @started_at).to_f end |
#worker_crashed ⇒ Object
64 65 66 |
# File 'lib/rspec/conductor/suite_run.rb', line 64 def worker_crashed @worker_crashes += 1 end |