Thursday, 15 August 2013

rspec - Ruby 2.0 Breaking Change? Date Comparison -


Heroki is saying that Ruby 2.0 is Okay, I will update my app but break my test. It was a failure:

  a_date.should == the_same_date   

dates are the same . How do I know that besides this, the same examination is passed under Ruby 1.9.3? It passes under 2.0:

  a_date.to_i.should == the_same_date.to_i   

Is there a bug in Ruby 2.0? I can not find anything about breaking the date of change.

UPDATE

Here is the actual test output:

  Failure / Error: target.should == @ Expected Gone: Mon, 24 June 2013 15:40:52 UTC + 00: 00 met: Mon, 24 June 2013 15:40:52 UTC + 00: 00 (Usage = =)    

This was a problem with the timecop; I guess In any case, switch to the head version to solve the problem.

The problem was caused by the cold as time was Time.current . It was closed twice a millisecond, instead of comparing it to the above code, as I mentioned above, I should compare the #to_f .

No comments:

Post a Comment