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]: > <#<Date: 4907679/2,0,2299161>> expected but was > <#<Date: 4907681/2,0,2299161>>. > > 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}")