From: Bill Kelly Date: 2006-09-21T12:11:31+09:00 Subject: Re: testunit message override? From: "Logan Capaldo" > > On Thu, Sep 21, 2006 at 10:20:06AM +0900, Ron Jeffries wrote: >> If this assert fails: >> >> assert_equal(Date.new(2006,4,15), calc.disbursal_date) >> >> it prints something like: >> >> test_PayFifteenthAfterQuarter(ProjectTest) [./projecttest.rb:13]: >> <#> expected but was >> <#>. >> >> With the dates in a rather odd format, as you see above. Yet Date's to_s method >> is perfectly reasonable. >> > It's not calling Date#to_s, it's calling Date#inspect. I think you can > do: > assert_equal( a = Date.new(2006, 4, 15), b = calc.disbursal_date, > "Expected Date of #{a}, got date of #{b}") Alternately, class Date alias_method :inspect, :to_s end ...to replace the old :inspect with :to_s. Regards, Bill