Class: Test::Unit::Notification
- Inherits:
-
Object
- Object
- Test::Unit::Notification
- Defined in:
- lib/test-unit-ext/notification.rb
Constant Summary collapse
- SINGLE_CHARACTER =
'N'
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#test_name ⇒ Object
readonly
Returns the value of attribute test_name.
Instance Method Summary collapse
-
#initialize(test_name, location, message) ⇒ Notification
constructor
Creates a new Notification with the given location and message.
-
#long_display ⇒ Object
Returns a verbose version of the error description.
-
#short_display ⇒ Object
Returns a brief version of the error description.
-
#single_character_display ⇒ Object
Returns a single character representation of a notification.
-
#to_s ⇒ Object
Overridden to return long_display.
Constructor Details
#initialize(test_name, location, message) ⇒ Notification
Creates a new Notification with the given location and message.
35 36 37 38 39 |
# File 'lib/test-unit-ext/notification.rb', line 35 def initialize(test_name, location, ) @test_name = test_name @location = location @message = end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
29 30 31 |
# File 'lib/test-unit-ext/notification.rb', line 29 def location @location end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
29 30 31 |
# File 'lib/test-unit-ext/notification.rb', line 29 def @message end |
#test_name ⇒ Object (readonly)
Returns the value of attribute test_name.
29 30 31 |
# File 'lib/test-unit-ext/notification.rb', line 29 def test_name @test_name end |
Instance Method Details
#long_display ⇒ Object
Returns a verbose version of the error description.
52 53 54 55 56 57 58 59 |
# File 'lib/test-unit-ext/notification.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 "Notification:\n#{@test_name}#{location_display}:\n#{@message}" end |
#short_display ⇒ Object
Returns a brief version of the error description.
47 48 49 |
# File 'lib/test-unit-ext/notification.rb', line 47 def short_display "#@test_name: #{@message.split("\n")[0]}" end |
#single_character_display ⇒ Object
Returns a single character representation of a notification.
42 43 44 |
# File 'lib/test-unit-ext/notification.rb', line 42 def single_character_display SINGLE_CHARACTER end |
#to_s ⇒ Object
Overridden to return long_display.
62 63 64 |
# File 'lib/test-unit-ext/notification.rb', line 62 def to_s long_display end |