implications: ensure antecedent/consequent tags exist.

This commit is contained in:
evazion
2018-12-26 17:30:07 -06:00
parent c27ba02b88
commit 51b08d2243
3 changed files with 9 additions and 8 deletions

View File

@@ -64,6 +64,13 @@ class TagImplicationTest < ActiveSupport::TestCase
assert_equal(CurrentUser.user.id, ti.creator_id)
end
should "ensure both tags exist" do
FactoryBot.create(:tag_implication, antecedent_name: "a", consequent_name: "b")
assert(Tag.exists?(name: "a"))
assert(Tag.exists?(name: "b"))
end
should "not validate when a tag directly implicates itself" do
ti = FactoryBot.build(:tag_implication, antecedent_name: "a", consequent_name: "a")