BURs: move cosplay tags when moving character tags.

When aliasing or renaming a character tag, move the corresponding
*_(cosplay) tag if it exists.
This commit is contained in:
evazion
2020-08-27 18:40:21 -05:00
parent 23944a1794
commit b9d904ac76
2 changed files with 25 additions and 0 deletions

View File

@@ -210,6 +210,21 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
assert_equal(false, @bur.valid?)
assert_equal(["Can't rename aaa -> bbb (the 'aaa' tag doesn't exist)"], @bur.errors.full_messages)
end
context "when renaming a character tag with a *_(cosplay) tag" do
should "move the *_(cosplay) tag as well" do
@post = create(:post, tag_string: "toosaka_rin_(cosplay)")
@wiki = create(:wiki_page, title: "toosaka_rin_(cosplay)")
@ta = create(:tag_alias, antecedent_name: "toosaka_rin", consequent_name: "tohsaka_rin")
@bur = create(:bulk_update_request, script: "rename toosaka_rin -> tohsaka_rin")
@bur.approve!(@admin)
perform_enqueued_jobs
assert_equal("cosplay tohsaka_rin tohsaka_rin_(cosplay)", @post.reload.tag_string)
assert_equal("tohsaka_rin_(cosplay)", @wiki.reload.title)
end
end
end
end