From: Robert Dober Date: 2006-05-25T04:55:19+09:00 Subject: Re: Overriding Time.now ------=_Part_179779_15138635.1148500516283 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 5/24/06, Jim Weirich wrote: > > Molitor, Stephen L wrote: > >> I believe that you can redefine Time.now in the scope where you need > >> it without interfering with Test::Unit > > > > There's only one instance of the Time class object, and any changes you > > make to it are in effect 'global'. Although I do not understand it (this is not an anomaly of the universe though), it does not look like it please kindly look at this ------------------------------------ >8 --------------------------------- robert@roma:~/ruby/tests$ cat test1.rb;./test1.rb #!/usr/bin/env ruby require 'date' module ToBTested class Time class << self def now; "right now?"; end end end puts "Inside module ToBTested: " << Time.now.to_s end puts "Outside module ToBTested: " << Time.now.to_s Inside module ToBTested: right now? Outside module ToBTested: Wed May 24 21:47:44 CEST 2006 --------------------------- 8< ----------------------------------------------- *** HOWEVER *** this theoretical possibility will probably not help the OP because Test::Unit might not have access to the unaltered version of Time (please note, this is ruby-talk not physics-talk) when executing in Testcase context. I had no time (again) going through this during working hours but if someon= e would care to explain the exact location where the inconsistency occurs withing Test::Unit I would gladly have a look. Cheers Robert ------=_Part_179779_15138635.1148500516283--