in spec/api/notifications_spec.rb [31:68]
def get_thread_notification(comment_body, options = {})
start_time = Time.now
user = User.create(:external_id => 1,:username => "example")
thread = create_thread(user, options)
subscription = Subscription.create(:subscriber_id => user._id.to_s, :source_id => thread._id.to_s)
comment = Comment.new
comment.comment_thread_id = thread.id
comment.body = comment_body
comment.author_id = user.id
comment.course_id = 'test course'
comment.save!
sleep 1
end_time = Time.now
post(
"/api/v1/notifications",
{
from: CGI::escape(start_time.to_s),
to: CGI::escape(end_time.to_s),
user_ids: subscription.subscriber_id
}
)
last_response.should be_ok
response_hash = JSON.parse(last_response.body)
return response_hash[user.id][comment.course_id][thread.id.to_s]
end