Skip to content

Instantly share code, notes, and snippets.

@djsun
Created August 6, 2009 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djsun/163512 to your computer and use it in GitHub Desktop.
Save djsun/163512 to your computer and use it in GitHub Desktop.
should "set updated_at on document update but leave created_at alone" do
doc = @document.create(:first_name => 'John', :age => 27)
old_created_at = doc.created_at
old_updated_at = doc.updated_at
sleep 1
@document.update(doc._id, { :first_name => 'Johnny' })
from_db = @document.find(doc.id)
from_db.created_at.to_i.should == old_created_at.to_i
from_db.updated_at.to_i.should_not == old_updated_at.to_i
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment