Trouble comparing time with RSpec

后端 未结 7 712
北荒
北荒 2020-12-12 15:23

I am using Ruby on Rails 4 and the rspec-rails gem 2.14. For a my object I would like to compare the current time with the updated_at object attribute after a c

相关标签:
7条回答
  • 2020-12-12 16:11

    I find using the be_within default rspec matcher more elegant:

    expect(@article.updated_at.utc).to be_within(1.second).of Time.now
    
    0 讨论(0)
提交回复
热议问题