diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2006-12-10 18:35:48 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2006-12-10 18:35:48 +0000 |
commit | 55ed70529aefdb3029f5ab72169b2f7909b2f2a3 (patch) | |
tree | 1f1dbf48685483905949c121cafe36e26c7efc7c /test/unit/comment_test.rb | |
parent | 28c6aa4e6dfe7b4261cd4b4feb50eda62ace0572 (diff) | |
download | redmine-55ed70529aefdb3029f5ab72169b2f7909b2f2a3.tar.gz redmine-55ed70529aefdb3029f5ab72169b2f7909b2f2a3.zip |
added model Comment.
comments can now be added on news.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@81 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/comment_test.rb')
-rw-r--r-- | test/unit/comment_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb new file mode 100644 index 000000000..4435f0a7f --- /dev/null +++ b/test/unit/comment_test.rb @@ -0,0 +1,30 @@ +require File.dirname(__FILE__) + '/../test_helper' + +class CommentTest < Test::Unit::TestCase + fixtures :users, :news, :comments + + def setup + @jsmith = User.find(2) + @news = News.find(1) + end + + def test_create + comment = Comment.new(:commented => @news, :author => @jsmith, :comment => "my comment") + assert comment.save + @news.reload + assert_equal 2, @news.comments_count + end + + def test_validate + comment = Comment.new(:commented => @news) + assert !comment.save + assert_equal 2, comment.errors.length + end + + def test_destroy + comment = Comment.find(1) + assert comment.destroy + @news.reload + assert_equal 0, @news.comments_count + end +end |