123456789_123456789_123456789_123456789_123456789_

Class: Test::Unit::Notification

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Inherits: Object
Defined in: lib/test/unit/notification.rb

Constant Summary

Util::BacktraceFilter - Included

TESTUNIT_FILE_SEPARATORS, TESTUNIT_PREFIX, TESTUNIT_RB_FILE

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Util::BacktraceFilter - Included

Constructor Details

.new(test_name, location, message, options = {}) ⇒ Notification

Creates a new Notification with the given location and message.

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 15

def initialize(test_name, location, message, options={})
  @test_name = test_name
  @location = location
  @message = message
  @method_name = options[:method_name]
end

Instance Attribute Details

#critical?Boolean (readonly)

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 47

def critical?
  false
end

#location (readonly)

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 7

attr_reader :test_name, :location, :message

#message (readonly)

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 7

attr_reader :test_name, :location, :message

#method_name (readonly)

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 8

attr_reader :method_name

#test_name (readonly)

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 7

attr_reader :test_name, :location, :message

Instance Method Details

#label

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 27

def label
  LABEL
end

#long_display

Returns a verbose version of the error description.

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 37

def long_display
  backtrace = filter_backtrace(location).join("\n")
  "#{label}: #{@message}\n#{@test_name}\n#{backtrace}"
end

#short_display

Returns a brief version of the error description.

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 32

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

#single_character_display

Returns a single character representation of a notification.

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 23

def single_character_display
  SINGLE_CHARACTER
end

#to_s

Overridden to return long_display.

[ GitHub ]

  
# File 'lib/test/unit/notification.rb', line 43

def to_s
  long_display
end