Commit c34cadf1e2fc1133fa6cdec7f88bc0da1f87b1bd
1 parent
ebdbd8ac
Exists in
master
and in
28 other branches
Fixed failing tests
Showing
1 changed file
with
9 additions
and
5 deletions
Show diff stats
test/unit/comment_test.rb
@@ -301,17 +301,19 @@ class CommentTest < ActiveSupport::TestCase | @@ -301,17 +301,19 @@ class CommentTest < ActiveSupport::TestCase | ||
301 | assert result[1].replies.empty? | 301 | assert result[1].replies.empty? |
302 | end | 302 | end |
303 | 303 | ||
304 | - should "return activities comments when some comment on thread is spam" do | 304 | + should "return activities comments when some comment on thread is spam and not display its replies" do |
305 | person = fast_create(Person) | 305 | person = fast_create(Person) |
306 | a = TextileArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') | 306 | a = TextileArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') |
307 | c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) | 307 | c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) |
308 | c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person) | 308 | c1 = Comment.create(:reply_of_id => c0.id, :source => a, :body => 'c1', :author => person) |
309 | - spam = Comment.create(:spam => true, :reply_of_id => c0.id, :source => a, :body => 'spam', :author => person) | ||
310 | - c2 = Comment.create(:reply_of_id => spam.id, :source => a, :body => 'c2', :author => person) | ||
311 | - result = a.activity.comments_as_thread | 309 | + c2 = Comment.create(:source => a, :body => 'c2', :author => person) |
310 | + spam = Comment.create(:spam => true, :reply_of_id => c2.id, :source => a, :body => 'spam', :author => person) | ||
311 | + spam_reply = Comment.create(:reply_of_id => spam.id, :source => a, :body => 'spam reply', :author => person) | ||
312 | + result = a.activity.comments | ||
312 | assert_equal c0, result[0] | 313 | assert_equal c0, result[0] |
313 | - assert_equal [c1], result[0].replies | 314 | + assert_equal [c1], result[0].replies.without_spam |
314 | assert_equal c2, result[1] | 315 | assert_equal c2, result[1] |
316 | + assert_equal [], result[1].replies.without_spam | ||
315 | end | 317 | end |
316 | 318 | ||
317 | should 'provide author url for authenticated user' do | 319 | should 'provide author url for authenticated user' do |
@@ -418,6 +420,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -418,6 +420,7 @@ class CommentTest < ActiveSupport::TestCase | ||
418 | end | 420 | end |
419 | 421 | ||
420 | should 'be able to select non-spam comments' do | 422 | should 'be able to select non-spam comments' do |
423 | + Comment.destroy_all | ||
421 | c1 = fast_create(Comment) | 424 | c1 = fast_create(Comment) |
422 | c2 = fast_create(Comment, :spam => false) | 425 | c2 = fast_create(Comment, :spam => false) |
423 | c3 = fast_create(Comment, :spam => true) | 426 | c3 = fast_create(Comment, :spam => true) |
@@ -689,6 +692,7 @@ class CommentTest < ActiveSupport::TestCase | @@ -689,6 +692,7 @@ class CommentTest < ActiveSupport::TestCase | ||
689 | end | 692 | end |
690 | 693 | ||
691 | should 'be able to select non-reply comments' do | 694 | should 'be able to select non-reply comments' do |
695 | + Comment.destroy_all | ||
692 | c1 = fast_create(Comment) | 696 | c1 = fast_create(Comment) |
693 | c2 = fast_create(Comment, :reply_of_id => c1.id) | 697 | c2 = fast_create(Comment, :reply_of_id => c1.id) |
694 | c3 = fast_create(Comment, :reply_of_id => c2.id) | 698 | c3 = fast_create(Comment, :reply_of_id => c2.id) |