Class: Test::Unit::Pending

Inherits:
Object
  • Object
show all
Defined in:
lib/test-unit-ext/pending.rb

Constant Summary collapse

SINGLE_CHARACTER =
'P'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_name, location, message) ⇒ Pending

Creates a new Pending with the given location and message.



35
36
37
38
39
# File 'lib/test-unit-ext/pending.rb', line 35

def initialize(test_name, location, message)
  @test_name = test_name
  @location = location
  @message = message
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



29
30
31
# File 'lib/test-unit-ext/pending.rb', line 29

def location
  @location
end

#messageObject (readonly)

Returns the value of attribute message.



29
30
31
# File 'lib/test-unit-ext/pending.rb', line 29

def message
  @message
end

#test_nameObject (readonly)

Returns the value of attribute test_name.



29
30
31
# File 'lib/test-unit-ext/pending.rb', line 29

def test_name
  @test_name
end

Instance Method Details

#long_displayObject

Returns a verbose version of the error description.



52
53
54
55
56
57
58
59
# File 'lib/test-unit-ext/pending.rb', line 52

def long_display
  if location.size == 1
    location_display = location[0].sub(/\A(.+:\d+).*/, ' [\\1]')
  else
    location_display = "\n" + location.join("\n")
  end
  "Pending:\n#{@test_name}#{location_display}:\n#{@message}"
end

#short_displayObject

Returns a brief version of the error description.



47
48
49
# File 'lib/test-unit-ext/pending.rb', line 47

def short_display
  "#@test_name: #{@message.split("\n")[0]}"
end

#single_character_displayObject

Returns a single character representation of a pending.



42
43
44
# File 'lib/test-unit-ext/pending.rb', line 42

def single_character_display
  SINGLE_CHARACTER
end

#to_sObject

Overridden to return long_display.



62
63
64
# File 'lib/test-unit-ext/pending.rb', line 62

def to_s
  long_display
end