On May 4, 2008, at 11:07 PM, Aslak Hellesøy wrote:
If your code uses Date#now, always make sure you stub it in your
specs. Always.
Yes, but the OP's question was why do two "same" date objects compare
as different. This is a typical problem with floating-point and
anything that counts tim
The (pretty much universal) problem with dates and times is that people use
"date" and "time" to mean different things. There's a java library called
joda that provides a really clean vocabulary around this.
An *instant* is a point in time. You shouldn't be able to ask for two
instants and get the
On 5.5.2008, at 11.02, Pat Maddox wrote:
Yes, that was my first idea as well. The Time class is a little
fucked up in that
< a, b = Time.now, Time.now
< a == b #=> false
That's definitely a gotcha but I wouldn't necessarily say it's fucked
up. It's just that Time#now returns the curren
Yes, that was my first idea as well. The Time class is a little
fucked up in that
< a, b = Time.now, Time.now
< a == b #=> false
So if you're using Time anywhere, you really ought to be stubbing it.
"always"
:)
Pat
On Sun, May 4, 2008 at 11:07 PM, Aslak Hellesøy
<[EMAIL PROTECTED]> wrote
If your code uses Date#now, always make sure you stub it in your
specs. Always.
On 5. mai. 2008, at 05.42, "s.ross" <[EMAIL PROTECTED]> wrote:
Hi--
On May 3, 2008, at 9:17 AM, Joe Van Dyk wrote:
I occasionally get this error:
1)
'A puzzle once featured, should no longer be nominated' FAIL
Hi--
On May 3, 2008, at 9:17 AM, Joe Van Dyk wrote:
I occasionally get this error:
1)
'A puzzle once featured, should no longer be nominated' FAILED
expected: Sun May 04 09:10:26 -0700 2008,
got: Sun May 04 09:10:26 -0700 2008 (using ==)
./spec/models/puzzle_spec.rb:180:
So, the dates l
On May 3, 2008, at 2:16 PM, Kyle Hargraves wrote:
On Sat, May 3, 2008 at 1:12 PM, Steve Downey
<[EMAIL PROTECTED]> wrote:
Is there more precision than seconds in a Time instance?
irb(main):006:0> a,b = Time.now, Time.now
=> [Sat May 03 11:06:31 -0700 2008, Sat May 03 11:06:31 -0700 2008]
irb
On Sat, May 3, 2008 at 1:12 PM, Steve Downey <[EMAIL PROTECTED]> wrote:
> Is there more precision than seconds in a Time instance?
>
> irb(main):006:0> a,b = Time.now, Time.now
> => [Sat May 03 11:06:31 -0700 2008, Sat May 03 11:06:31 -0700 2008]
> irb(main):007:0> puts a.to_i, b.to_i
> 1209837991
>
> Just because too objects have the same to_s representation don't mean
> they are equal:
The important equality in this case is what matters to the tester.
>
> This is a similar issue to Floats where there's more precision than
> the exernal representation shows.
>
Is there more precision t
On Sat, May 3, 2008 at 12:17 PM, Joe Van Dyk <[EMAIL PROTECTED]> wrote:
> I occasionally get this error:
>
> 1)
> 'A puzzle once featured, should no longer be nominated' FAILED
> expected: Sun May 04 09:10:26 -0700 2008,
> got: Sun May 04 09:10:26 -0700 2008 (using ==)
> ./spec/models/puzz
I've seen that one too. Maybe has to do with how equality is defined in the
Time or DateTime class.
I get around it by comparing the string-ified versions:
foo.time.to_s.should == expected_time.to_s
On Sat, May 3, 2008 at 9:17 AM, Joe Van Dyk <[EMAIL PROTECTED]> wrote:
> I occasionally get
I occasionally get this error:
1)
'A puzzle once featured, should no longer be nominated' FAILED
expected: Sun May 04 09:10:26 -0700 2008,
got: Sun May 04 09:10:26 -0700 2008 (using ==)
./spec/models/puzzle_spec.rb:180:
So, the dates looks the same to me. Any ideas for how to debug?
Joe
12 matches
Mail list logo