Class: BladeRunner::CombinedTestResults

Inherits:
Object
  • Object
show all
Defined in:
lib/blade_runner/combined_test_results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sessions) ⇒ CombinedTestResults

Returns a new instance of CombinedTestResults.



4
5
6
7
# File 'lib/blade_runner/combined_test_results.rb', line 4

def initialize(sessions)
  @sessions = sessions
  @all_test_results = sessions.map(&:test_results)
end

Instance Attribute Details

#all_test_resultsObject (readonly)

Returns the value of attribute all_test_results.



2
3
4
# File 'lib/blade_runner/combined_test_results.rb', line 2

def all_test_results
  @all_test_results
end

#sessionsObject (readonly)

Returns the value of attribute sessions.



2
3
4
# File 'lib/blade_runner/combined_test_results.rb', line 2

def sessions
  @sessions
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/blade_runner/combined_test_results.rb', line 26

def failed?
  statuses.include?("failed")
end

#lines(type = :results) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/blade_runner/combined_test_results.rb', line 13

def lines(type = :results)
  sessions.flat_map do |session|
    session.test_results.send(type).map do |line|
      line.sub(/ok/, "ok [#{session}]")
    end
  end
end

#to_sObject



21
22
23
24
# File 'lib/blade_runner/combined_test_results.rb', line 21

def to_s
  lines = ["1..#{total}"] + lines(:failures) + lines(:passes)
  lines.join("\n")
end

#totalObject



9
10
11
# File 'lib/blade_runner/combined_test_results.rb', line 9

def total
  sum(totals)
end