2019-10-29 10:08:37 -04:00
|
|
|
require_relative './helper'
|
|
|
|
|
|
|
|
class VerboseFormatterTest < Test::Unit::TestCase
|
|
|
|
def setup
|
|
|
|
require_relative File.join(DidYouMean::TestHelper.root, 'verbose')
|
2020-05-22 17:17:10 -04:00
|
|
|
|
2020-02-09 04:34:47 -05:00
|
|
|
DidYouMean.formatter = DidYouMean::VerboseFormatter.new
|
2019-10-29 10:08:37 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def teardown
|
|
|
|
DidYouMean.formatter = DidYouMean::PlainFormatter.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_message
|
|
|
|
@error = assert_raise(NoMethodError){ 1.zeor? }
|
|
|
|
|
2019-11-30 22:29:02 -05:00
|
|
|
assert_match <<~MESSAGE.strip, @error.message
|
2019-10-29 10:08:37 -04:00
|
|
|
undefined method `zeor?' for 1:Integer
|
|
|
|
|
|
|
|
Did you mean? zero?
|
|
|
|
MESSAGE
|
|
|
|
end
|
|
|
|
end
|