aboutsummaryrefslogtreecommitdiff
path: root/test/models/comment_test.rb
blob: 087963a16276fab281df58c7c2b0766b473fe75f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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