Class: Petitest::Texts::TestCaseResultCharacterText

Inherits:
BaseText
  • Object
show all
Defined in:
lib/petitest/texts/test_case_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_case:) ⇒ TestCaseResultCharacterText

Returns a new instance of TestCaseResultCharacterText.

Parameters:



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

def initialize(test_case:)
  @test_case = test_case
end

Instance Attribute Details

#test_casePetitest::TestCase (readonly)

Returns:



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

def test_case
  @test_case
end

Instance Method Details

#to_sObject

Note:

Override



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

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