Class: RSpec::Conductor::SuiteRun

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/conductor/suite_run.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSuiteRun

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

#errorsObject

Returns the value of attribute errors.



6
7
8
# File 'lib/rspec/conductor/suite_run.rb', line 6

def errors
  @errors
end

#example_statsObject

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_failedObject

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_passedObject

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_pendingObject

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_processedObject

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_totalObject

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_atObject

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_crashesObject

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(message)
  @example_stats << message.slice(:id, :location, :run_time, :description).merge(status: "failed")
  @examples_failed += 1
  @errors << message
end

#example_filtered(message) ⇒ Object



42
43
44
# File 'lib/rspec/conductor/suite_run.rb', line 42

def example_filtered(message)
  @example_stats << message.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(message)
  @example_stats << message.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(message)
  @example_stats << message.slice(:id, :location).merge(status: "pending")
  @examples_pending += 1
end

#spec_file_assignedObject



46
47
48
# File 'lib/rspec/conductor/suite_run.rb', line 46

def spec_file_assigned
  @specs_started_at ||= Time.now
end

#spec_file_completeObject



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(message)
  @errors << message
end

#spec_file_processed_percentageObject



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_runtimeObject



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

Returns:

  • (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_completeObject



68
69
70
# File 'lib/rspec/conductor/suite_run.rb', line 68

def suite_complete
  @specs_completed_at ||= Time.now
end

#total_runtimeObject



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_crashedObject



64
65
66
# File 'lib/rspec/conductor/suite_run.rb', line 64

def worker_crashed
  @worker_crashes += 1
end