Encapsulates an error in a test. Created by Test::Unit::TestCase when it rescues an exception thrown during the processing of a test.
Creates a new Error with the given #test_name and exception.
# File test/unit/error.rb, line 24
def initialize(test_name, exception)
@test_name = test_name
@exception = exception
end
Returns a verbose version of the error description.
# File test/unit/error.rb, line 45
def long_display
backtrace = filter_backtrace(@exception.backtrace).join("\n ")
"Error:\n#@test_name:\n#{message}\n #{backtrace}"
end
Returns the message associated with the error.
# File test/unit/error.rb, line 35
def message
"#{@exception.class.name}: #{@exception.message}"
end
Returns a brief version of the error description.
# File test/unit/error.rb, line 40
def short_display
"#@test_name: #{message.split("\n")[0]}"
end