Fix #4014: Incorrect tag type counts on posts.

This commit is contained in:
evazion
2018-12-19 12:20:29 -06:00
parent 3adf24c0aa
commit 3e382bd831
2 changed files with 13 additions and 1 deletions

View File

@@ -208,6 +208,17 @@ class TagTest < ActiveSupport::TestCase
assert_equal(0, tag.reload.category)
end
should "update post tag counts when the category is changed" do
post = FactoryBot.create(:post, tag_string: "test")
assert_equal(1, post.tag_count_general)
assert_equal(0, post.tag_count_character)
tag = Tag.find_or_create_by_name("char:test")
post.reload
assert_equal(0, post.tag_count_general)
assert_equal(1, post.tag_count_character)
end
should "be created when one doesn't exist" do
assert_difference("Tag.count", 1) do
tag = Tag.find_or_create_by_name("hoge")