Class: Petitest::Texts::TestResultCharacterText

Inherits:
BaseText
  • Object
show all
Defined in:
lib/petitest/texts/test_result_character_text.rb

Constant Summary

Constants inherited from BaseText

BaseText::ANSI_COLOR_CODE_BY_COLOR_TYPE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test:) ⇒ TestResultCharacterText

Returns a new instance of TestResultCharacterText.

Parameters:



10
11
12
# File 'lib/petitest/texts/test_result_character_text.rb', line 10

def initialize(test:)
  @test = test
end

Instance Attribute Details

#testPetitest::Test (readonly)

Returns:



7
8
9
# File 'lib/petitest/texts/test_result_character_text.rb', line 7

def test
  @test
end

Instance Method Details

#to_sObject

Note:

Override



15
16
17
18
19
20
21
22
23
24
# File 'lib/petitest/texts/test_result_character_text.rb', line 15

def to_s
  case
  when test.runner.failed?
    colorize("F", :error)
  when test.runner.skipped?
    colorize("*", :skip)
  else
    "."
  end
end