took a while to double check the answer here, and it turns out to be a bug.
 after doing user.mark_as_read the type of the key added to
user.read_states.last_read_times is a bson id.  after doing user.reload,
the type of that key is a string.  i'm not sure if this is a bug in
mongoid, moped, or our code - documentation is thin.


On Mon, Oct 7, 2013 at 11:37 AM, Greg Price <notifications@github.com>wrote:

> In spec/api/comment_thread_spec.rb:
>
> > +          user = create_test_user(123)
> > +          [@threads["t1"], @threads["t2"]].each do |t|
> > +            t.course_id = "abc"
> > +            t.save!
> > +          end
> > +          rs = thread_result course_id: "abc", user_id: "123", sort_order: "asc"
> > +          rs.length.should == 2
> > +          rs.each_with_index { |result, i|
> > +            check_thread_result(user, @threads["t#{i+1}"], result)
> > +            result["course_id"].should == "abc"
> > +            result["unread_comments_count"].should == 5
> > +            result["read"].should == false
> > +          }
> > +
> > +          user.mark_as_read(@threads["t1"])
> > +          user.reload
>
> Why is this necessary?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/edx/cs_comments_service/pull/55/files#r6800550>
> .
>