diff options
Diffstat (limited to 'test/models/comment_test.rb')
| -rw-r--r-- | test/models/comment_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/models/comment_test.rb b/test/models/comment_test.rb new file mode 100644 index 0000000..087963a --- /dev/null +++ b/test/models/comment_test.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require 'test_helper' + +class CommentTest < ActiveSupport::TestCase + test 'content is present' do + comment = Comment.new(thing_id: things(:thing1).id) + assert_raise(ActiveRecord::RecordInvalid) { comment.save! } + + comment.content = 'whatever' + assert_difference('Comment.count') { comment.save! } + end + + test 'has many tags through tag_references' do + comment = comments(:comment1) + assert comment.tags.size == 1 + end +end |
