Commit c2b41750 by Rocky Duan

should return sub comment

parent 9d68984b
...@@ -59,10 +59,10 @@ post '/api/v1/comments/:comment_id' do |comment_id| ...@@ -59,10 +59,10 @@ post '/api/v1/comments/:comment_id' do |comment_id|
else else
comment_params = params.select {|key, value| %w{body title user_id course_id}.include? key}.merge({:comment_thread_id => comment.comment_thread_id}) comment_params = params.select {|key, value| %w{body title user_id course_id}.include? key}.merge({:comment_thread_id => comment.comment_thread_id})
sub_comment = comment.children.create(comment_params) sub_comment = comment.children.create(comment_params)
if comment.valid? if sub_comment.valid?
comment.to_json sub_comment.to_json
else else
error 400, comment.errors.to_json error 400, sub_comment.errors.to_json
end end
end end
end end
......
...@@ -119,7 +119,7 @@ describe "app" do ...@@ -119,7 +119,7 @@ describe "app" do
c["votes"]["up"].should == 0 c["votes"]["up"].should == 0
c["votes"]["down"].should == 0 c["votes"]["down"].should == 0
c["votes"]["plusminus"].should == 0 c["votes"]["plusminus"].should == 0
c["children"].should be_nil c["children"].length.should == 0
end end
end end
describe "DELETE on /api/v1/commentables/:commentable_type/:commentable_id" do describe "DELETE on /api/v1/commentables/:commentable_type/:commentable_id" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment