Project

General

Profile

Patch #43289 » fix-news-comments_count.patch

Go MAEDA, 2025-10-04 10:24

View differences:

test/fixtures/news.yml
10 10
    Visit http://ecookbook.somenet.foo/
11 11
  summary: First version was released...
12 12
  author_id: 2
13
  comments_count: 1
13
  comments_count: 2
14 14
news_002: 
15 15
  created_on: 2006-07-19 22:42:58 +02:00
16 16
  project_id: 1
test/unit/comment_test.rb
30 30
    comment = Comment.new(:commented => @news, :author => @jsmith, :comments => "my comment")
31 31
    assert comment.save
32 32
    @news.reload
33
    assert_equal 2, @news.comments_count
33
    assert_equal 3, @news.comments_count
34 34
  end
35 35

  
36 36
  def test_create_should_send_notification
......
53 53
    comment = Comment.find(1)
54 54
    assert comment.destroy
55 55
    @news.reload
56
    assert_equal 0, @news.comments_count
56
    assert_equal 1, @news.comments_count
57 57
  end
58 58
end
(3-3/4)