Commit 93774c73 by Greg Price

Use thread presenter in thread creation response

parent c32591b6
......@@ -41,6 +41,7 @@ post "#{APIPREFIX}/:commentable_id/threads" do |commentable_id|
error 400, thread.errors.full_messages.to_json
else
user.subscribe(thread) if bool_auto_subscribe
thread.to_hash.to_json
presenter = ThreadPresenter.factory(thread, nil)
presenter.to_hash.to_json
end
end
......@@ -93,6 +93,10 @@ describe "app" do
old_count = CommentThread.count
post '/api/v1/question_1/threads', default_params
last_response.should be_ok
result = parse(last_response.body)
result["read"].should == false
result["unread_comments_count"].should == 0
result["endorsed"].should == false
CommentThread.count.should == old_count + 1
CommentThread.where(title: "Interesting question").first.should_not be_nil
end
......
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