def test_length_key_invalid
tag = create(:relation_tag)
tag.k = "k" * 256
- assert_not tag.valid?, "Key should be too long"
+ assert_not_predicate tag, :valid?, "Key should be too long"
assert_predicate tag.errors[:k], :any?
end
def test_length_value_invalid
tag = create(:relation_tag)
tag.v = "v" * 256
- assert_not tag.valid?, "Value should be too long"
+ assert_not_predicate tag, :valid?, "Value should be too long"
assert_predicate tag.errors[:v], :any?
end
def test_orphaned_tag_invalid
tag = create(:relation_tag)
tag.relation = nil
- assert_not tag.valid?, "Orphaned tag should be invalid"
+ assert_not_predicate tag, :valid?, "Orphaned tag should be invalid"
assert_predicate tag.errors[:relation], :any?
end
existing = create(:relation_tag)
tag = build(:relation_tag, :relation => existing.relation, :k => existing.k, :v => existing.v)
assert_predicate tag, :new_record?
- assert_not tag.valid?
+ assert_not_predicate tag, :valid?
assert_raise(ActiveRecord::RecordInvalid) { tag.save! }
assert_predicate tag, :new_record?
end