aliases: warn about conflicting wikis when alias is requested.
* Warn about conflicting wiki pages during secondary validation. * Only warn about missing wiki if both tags are missing a wiki page.
This commit is contained in:
@@ -42,6 +42,25 @@ class TagAliasTest < ActiveSupport::TestCase
|
||||
|
||||
should_not allow_value(nil).for(:creator_id)
|
||||
should_not allow_value(-1).for(:creator_id).with_message("must exist", against: :creator)
|
||||
|
||||
end
|
||||
|
||||
context "on secondary validation" do
|
||||
should "warn about missing wiki pages" do
|
||||
ti = FactoryBot.build(:tag_alias, antecedent_name: "aaa", consequent_name: "bbb", skip_secondary_validations: false)
|
||||
|
||||
assert(ti.invalid?)
|
||||
assert_includes(ti.errors[:base], "The bbb tag needs a corresponding wiki page")
|
||||
end
|
||||
|
||||
should "warn about conflicting wiki pages" do
|
||||
FactoryBot.create(:wiki_page, title: "aaa", body: "aaa")
|
||||
FactoryBot.create(:wiki_page, title: "bbb", body: "bbb")
|
||||
ti = FactoryBot.build(:tag_alias, antecedent_name: "aaa", consequent_name: "bbb", skip_secondary_validations: false)
|
||||
|
||||
assert(ti.invalid?)
|
||||
assert_includes(ti.errors[:base], "The tag alias [[aaa]] -> [[bbb]] has conflicting wiki pages. [[bbb]] should be updated to include information from [[aaa]] if necessary.")
|
||||
end
|
||||
end
|
||||
|
||||
should "populate the creator information" do
|
||||
|
||||
Reference in New Issue
Block a user