Fix #3450: Aliased tags show up under translated tags.

Resolves aliases in translated tags. For example, say we lookup `遠坂凛`
and find `tohsaka_rin` and `toosaka_rin`. We apply aliases so that
`tohsaka_rin` becomes `toosaka_rin`, which is then returned as the only
translated tag.
This commit is contained in:
evazion
2017-12-23 12:26:40 -06:00
parent 806513836b
commit 265377bdbb
2 changed files with 14 additions and 1 deletions

View File

@@ -217,6 +217,17 @@ module Sources
assert_includes(@translated_tags, "fate/grand_order")
assert_equal(false, @translated_tags.grep("fate").any?)
end
should "apply aliases to translated tags" do
tohsaka_rin = FactoryGirl.create(:tag, name: "tohsaka_rin")
toosaka_rin = FactoryGirl.create(:tag, name: "toosaka_rin")
FactoryGirl.create(:wiki_page, title: "tohsaka_rin", other_names: "遠坂凛")
FactoryGirl.create(:wiki_page, title: "toosaka_rin", other_names: "遠坂凛")
FactoryGirl.create(:tag_alias, antecedent_name: "tohsaka_rin", consequent_name: "toosaka_rin")
assert_equal([toosaka_rin], @site.translate_tag("遠坂凛"))
end
end
end
end