spec/mongomodel/support/scope_spec.rb in mongomodel-0.2.20 vs spec/mongomodel/support/scope_spec.rb in mongomodel-0.3.0

- old
+ new

@@ -925,16 +925,20 @@ from(OtherPost.collection) end subject { scoped } + def truncate_timestamp(time) + time.change(:usec => (time.usec / 1000.0).floor * 1000) + end + def model OtherPost end def finder_options { - :conditions => { "author" => "Sam", "published" => true, "date" => { "$lt" => timestamp } }, + :conditions => { "author" => "Sam", "published" => true, "date" => { "$lt" => truncate_timestamp(timestamp.utc) } }, :order => [:author.asc, :published.desc], :select => [:author, :published], :offset => 15, :limit => 7 }