class Petitest::Texts::TestsResultText
Attributes
finished_at[R]
@return [Time]
started_at[R]
@return [Time]
tests[R]
@return [Array<Petitest::Test>]
Public Class Methods
new( finished_at:, started_at:, tests: )
click to toggle source
@param finished_at
[Time] @param started_at
[Time] @param tests [Array<Petitest::Test>]
# File lib/petitest/texts/tests_result_text.rb, line 18 def initialize( finished_at:, started_at:, tests: ) @finished_at = finished_at @started_at = started_at @tests = tests end
Public Instance Methods
to_s()
click to toggle source
@note Override
# File lib/petitest/texts/tests_result_text.rb, line 29 def to_s [ header, body, ].join end
Private Instance Methods
body()
click to toggle source
@return [String]
# File lib/petitest/texts/tests_result_text.rb, line 39 def body texts = [] texts << ::Petitest::Texts::FailuresText.new(tests: tests_failed) unless tests_failed.empty? texts << ::Petitest::Texts::TestCountsText.new(tests: tests) texts << ::Petitest::Texts::TimesText.new( finished_at: finished_at, started_at: started_at, ) texts.join("\n\n") end
header()
click to toggle source
@return [String]
# File lib/petitest/texts/tests_result_text.rb, line 51 def header ::Petitest::Texts::TestsResultMarginTopText.new(tests: tests).to_s end
tests_failed()
click to toggle source
@return [Array<Petitest::Test>]
# File lib/petitest/texts/tests_result_text.rb, line 56 def tests_failed @tests_failed ||= tests.select do |test| test.runner.failed? end end