File tree Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Expand file tree Collapse file tree 2 files changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ def to_hash(params={})
102
102
. merge ( "depth" => depth )
103
103
. merge ( "closed" => comment_thread . nil? ? false : comment_thread . closed ) # ditto
104
104
. merge ( "thread_id" => comment_thread_id )
105
+ . merge ( "parent_id" => parent_ids [ -1 ] )
105
106
. merge ( "commentable_id" => comment_thread . nil? ? nil : comment_thread . commentable_id ) # ditto
106
107
. merge ( "votes" => votes . slice ( *%w[ count up_count down_count point ] ) )
107
108
. merge ( "abuse_flaggers" => abuse_flaggers )
Original file line number Diff line number Diff line change 25
25
retrieved [ "children" ] . should be_nil
26
26
retrieved [ "votes" ] [ "point" ] . should == comment . votes_point
27
27
retrieved [ "depth" ] . should == comment . depth
28
+ retrieved [ "parent_id" ] . should == comment . parent_ids [ -1 ]
28
29
end
29
30
it "retrieve information of a single comment with its sub comments" do
30
31
comment = Comment . first
37
38
retrieved [ "votes" ] [ "point" ] . should == comment . votes_point
38
39
retrieved [ "children" ] . length . should == comment . children . length
39
40
retrieved [ "children" ] . select { |c | c [ "body" ] == comment . children . first . body } . first . should_not be_nil
41
+ retrieved [ "children" ] . each { |c | c [ "parent_id" ] . should == comment . id . to_s }
40
42
end
41
43
it "returns 400 when the comment does not exist" do
42
44
get "/api/v1/comments/does_not_exist"
You can’t perform that action at this time.
0 commit comments