aboutsummaryrefslogtreecommitdiff
path: root/test/models/comment_test.rb
blob: deb1a1d01838d54c1911e9eb3fc895d046c0981f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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_equal 1, comment.tags.size
  end
end