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_passed(message) ⇒ Object
- #example_pending ⇒ 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(:location, :run_time, :description) @examples_failed += 1 @errors << end |
#example_passed(message) ⇒ Object
26 27 28 29 |
# File 'lib/rspec/conductor/suite_run.rb', line 26 def example_passed() @example_stats << .slice(:location, :run_time, :description) @examples_passed += 1 end |
#example_pending ⇒ Object
37 38 39 |
# File 'lib/rspec/conductor/suite_run.rb', line 37 def example_pending @examples_pending += 1 end |
#spec_file_assigned ⇒ Object
41 42 43 |
# File 'lib/rspec/conductor/suite_run.rb', line 41 def spec_file_assigned @specs_started_at ||= Time.now end |
#spec_file_complete ⇒ Object
45 46 47 |
# File 'lib/rspec/conductor/suite_run.rb', line 45 def spec_file_complete @spec_files_processed += 1 end |
#spec_file_error(message) ⇒ Object
49 50 51 |
# File 'lib/rspec/conductor/suite_run.rb', line 49 def spec_file_error() @errors << end |
#spec_file_processed_percentage ⇒ Object
53 54 55 56 57 |
# File 'lib/rspec/conductor/suite_run.rb', line 53 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
67 68 69 |
# File 'lib/rspec/conductor/suite_run.rb', line 67 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
63 64 65 |
# File 'lib/rspec/conductor/suite_run.rb', line 63 def suite_complete @specs_completed_at ||= Time.now end |
#total_runtime ⇒ Object
71 72 73 |
# File 'lib/rspec/conductor/suite_run.rb', line 71 def total_runtime ((@specs_completed_at || Time.now) - @started_at).to_f end |
#worker_crashed ⇒ Object
59 60 61 |
# File 'lib/rspec/conductor/suite_run.rb', line 59 def worker_crashed @worker_crashes += 1 end |