Commit f7cd7f3d by Clinton Blackburn

Merge pull request #168 from edx/clintonb/remove-dead-code

Updated spec_helper
parents abc1c11b 042f9caa
...@@ -40,7 +40,6 @@ def set_api_key_header ...@@ -40,7 +40,6 @@ def set_api_key_header
end end
RSpec.configure do |config| RSpec.configure do |config|
config.include Rack::Test::Methods config.include Rack::Test::Methods
config.treat_symbols_as_metadata_keys_with_true_values = true config.treat_symbols_as_metadata_keys_with_true_values = true
...@@ -63,7 +62,7 @@ end ...@@ -63,7 +62,7 @@ end
def init_without_subscriptions def init_without_subscriptions
commentable = Commentable.new("question_1") commentable = Commentable.new("question_1")
users = (1..10).map{|id| create_test_user(id)} users = (1..10).map { |id| create_test_user(id) }
user = users.first user = users.first
thread = CommentThread.new(title: "I can't solve this problem", body: "can anyone help me?", course_id: "1", commentable_id: commentable.id) thread = CommentThread.new(title: "I can't solve this problem", body: "can anyone help me?", course_id: "1", commentable_id: commentable.id)
...@@ -132,12 +131,12 @@ def init_without_subscriptions ...@@ -132,12 +131,12 @@ def init_without_subscriptions
Comment.all.each do |c| Comment.all.each do |c|
user.vote(c, :up) # make the first user always vote up for convenience user.vote(c, :up) # make the first user always vote up for convenience
users[2,9].each {|user| user.vote(c, [:up, :down].sample)} users[2, 9].each { |user| user.vote(c, [:up, :down].sample) }
end end
CommentThread.all.each do |c| CommentThread.all.each do |c|
user.vote(c, :up) # make the first user always vote up for convenience user.vote(c, :up) # make the first user always vote up for convenience
users[2,9].each {|user| user.vote(c, [:up, :down].sample)} users[2, 9].each { |user| user.vote(c, [:up, :down].sample) }
end end
Content.mongo_client[:blocked_hash].insert_one(hash: Digest::MD5.hexdigest("blocked post")) Content.mongo_client[:blocked_hash].insert_one(hash: Digest::MD5.hexdigest("blocked post"))
...@@ -147,46 +146,6 @@ def init_without_subscriptions ...@@ -147,46 +146,6 @@ def init_without_subscriptions
end end
end end
def init_with_subscriptions
user1 = create_test_user(1)
user2 = create_test_user(2)
user2.subscribe(user1)
commentable = Commentable.new("question_1")
user1.subscribe(commentable)
user2.subscribe(commentable)
thread = CommentThread.new(title: "I can't solve this problem", body: "can anyone help me?", course_id: "1", commentable_id: commentable.id)
thread.author = user1
user1.subscribe(thread)
user2.subscribe(thread)
thread.save!
thread = thread.reload
comment = thread.comments.new(body: "this problem is so easy", course_id: "1")
comment.author = user2
comment.save!
comment1 = comment.children.new(body: "not for me!", course_id: "1")
comment1.author = user1
comment1.comment_thread = thread
comment1.save!
comment2 = comment1.children.new(body: "not for me neither!", course_id: "1")
comment2.author = user2
comment2.comment_thread = thread
comment2.save!
thread = CommentThread.new(title: "This problem is wrong", body: "it is unsolvable", course_id: "2", commentable_id: commentable.id)
thread.author = user2
user2.subscribe(thread)
thread.save!
thread = CommentThread.new(title: "I don't know what to say", body: "lol", course_id: "2", commentable_id: "something else")
thread.author = user1
thread.save!
end
# this method is used to test results produced using the helper function handle_threads_query # this method is used to test results produced using the helper function handle_threads_query
# which is used in multiple areas of the API # which is used in multiple areas of the API
def check_thread_result(user, thread, hash, is_json=false) def check_thread_result(user, thread, hash, is_json=false)
...@@ -409,5 +368,5 @@ def setup_10_threads ...@@ -409,5 +368,5 @@ def setup_10_threads
@comments["t#{i} c#{j}"] = comment @comments["t#{i} c#{j}"] = comment
end end
end end
@default_order = 10.times.map {|i| "t#{i}"}.reverse @default_order = 10.times.map { |i| "t#{i}" }.reverse
end 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