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
updated_at
You can convert the date/datetime/time object to a string as it's stored in the database with to_s(:db).
to_s(:db)
expect(@article.updated_at.to_s(:db)).to eq '2015-01-01 00:00:00' expect(@article.updated_at.to_s(:db)).to eq Time.current.to_s(:db)