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 | 301 | assert result[1].replies.empty? |
302 | 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 | 305 | person = fast_create(Person) |
306 | 306 | a = TextileArticle.create!(:profile => person, :name => 'My article', :body => 'Article body') |
307 | 307 | c0 = Comment.create(:source => a, :body => 'Root comment', :author => person) |
308 | 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 | 313 | assert_equal c0, result[0] |
313 | - assert_equal [c1], result[0].replies | |
314 | + assert_equal [c1], result[0].replies.without_spam | |
314 | 315 | assert_equal c2, result[1] |
316 | + assert_equal [], result[1].replies.without_spam | |
315 | 317 | end |
316 | 318 | |
317 | 319 | should 'provide author url for authenticated user' do |
... | ... | @@ -418,6 +420,7 @@ class CommentTest < ActiveSupport::TestCase |
418 | 420 | end |
419 | 421 | |
420 | 422 | should 'be able to select non-spam comments' do |
423 | + Comment.destroy_all | |
421 | 424 | c1 = fast_create(Comment) |
422 | 425 | c2 = fast_create(Comment, :spam => false) |
423 | 426 | c3 = fast_create(Comment, :spam => true) |
... | ... | @@ -689,6 +692,7 @@ class CommentTest < ActiveSupport::TestCase |
689 | 692 | end |
690 | 693 | |
691 | 694 | should 'be able to select non-reply comments' do |
695 | + Comment.destroy_all | |
692 | 696 | c1 = fast_create(Comment) |
693 | 697 | c2 = fast_create(Comment, :reply_of_id => c1.id) |
694 | 698 | c3 = fast_create(Comment, :reply_of_id => c2.id) | ... | ... |