Commit af7c7190 by Arjun Singh

Fix a broken spec; also fixes a bug where when the course_id wasn't set, no…

Fix a broken spec; also fixes a bug where when the course_id wasn't set, no threads would be returned.
parent 9f0bbe59
......@@ -76,7 +76,9 @@ helpers do
end
def handle_threads_query(comment_threads)
comment_threads = comment_threads.where(:course_id=>params[:course_id])
if params[:course_id]
comment_threads = comment_threads.where(:course_id=>params[:course_id])
end
if CommentService.config[:cache_enabled]
query_params = params.slice(*%w[course_id commentable_id sort_key sort_order page per_page user_id])
memcached_key = "threads_query_#{query_params.hash}"
......
......@@ -62,7 +62,7 @@ describe "app" do
changed_thread = CommentThread.find(thread.id)
changed_thread.body.should == "new body"
changed_thread.title.should == "new title"
changed_thread.commentable_id.should == "new commentable_id"
changed_thread.commentable_id.should == "new_commentable_id"
end
it "returns 400 when the thread does not exist" do
put "/api/v1/threads/does_not_exist", body: "new body", title: "new title"
......
......@@ -20,6 +20,9 @@ end
RSpec.configure do |config|
config.include Rack::Test::Methods
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run focus: true
config.run_all_when_everything_filtered = true
end
Mongoid.configure do |config|
......
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