在比较规范中的日期时出错

时间:2014-07-30 13:29:08

标签: ruby-on-rails ruby-on-rails-4 rspec rspec2 rspec-rails

面对这样的错误,怎么解决?

Failure/Error: specify{ subject[:ends_at].should eq challenge.ends_at.as_json }

   expected: "2014-08-29T08:20:47.019-05:00"
        got: "2014-08-29T08:20:47.000-05:00"

1 个答案:

答案 0 :(得分:2)

比较无毫秒或尝试冻结时间https://github.com/travisjeffery/timecop