From c34cadf1e2fc1133fa6cdec7f88bc0da1f87b1bd Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Fri, 7 Mar 2014 10:25:18 +0000 Subject: [PATCH] Fixed failing tests --- test/unit/comment_test.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 3cb1dd9..28a3d94 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -301,17 +301,19 @@ class CommentTest < ActiveSupport::TestCase assert result[1].replies.empty? end - should "return activities comments when some comment on thread is spam" do + should "return activities comments when some comment on thread is spam and not display its replies" do person = fast_create(Person) a = TextileArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person) - spam = Comment.create(:spam => true, :reply_of_id => c0.id, :source => a, :body => 'spam', :author => person) - c2 = Comment.create(:reply_of_id => spam.id, :source => a, :body => 'c2', :author => person) - result = a.activity.comments_as_thread + c2 = Comment.create(:source => a, :body => 'c2', :author => person) + spam = Comment.create(:spam => true, :reply_of_id => c2.id, :source => a, :body => 'spam', :author => person) + spam_reply = Comment.create(:reply_of_id => spam.id, :source => a, :body => 'spam reply', :author => person) + result = a.activity.comments assert_equal c0, result[0] - assert_equal [c1], result[0].replies + assert_equal [c1], result[0].replies.without_spam assert_equal c2, result[1] + assert_equal [], result[1].replies.without_spam end should 'provide author url for authenticated user' do @@ -418,6 +420,7 @@ class CommentTest < ActiveSupport::TestCase end should 'be able to select non-spam comments' do + Comment.destroy_all c1 = fast_create(Comment) c2 = fast_create(Comment, :spam => false) c3 = fast_create(Comment, :spam => true) @@ -689,6 +692,7 @@ class CommentTest < ActiveSupport::TestCase end should 'be able to select non-reply comments' do + Comment.destroy_all c1 = fast_create(Comment) c2 = fast_create(Comment, :reply_of_id => c1.id) c3 = fast_create(Comment, :reply_of_id => c2.id) -- libgit2 0.21.2