Make card title mandatory

We didn't add any validation rules to the card model. At the very least,
the title should be mandatory.

The fact that the label field is marked as optional in the form but the
other fields are not probably means description and link should be
mandatory as well. However, since there might be institutions using
cards with descriptions but no link or cards with links but no
description, so we're keeping these fields optional for compatibility
reasons. We might change our minds in the future, though.
This commit is contained in:
Javi Martín
2021-01-06 14:12:38 +01:00
parent 36037bbc55
commit c1c84507b8
5 changed files with 30 additions and 2 deletions

View File

@@ -9,6 +9,10 @@ describe Widget::Card do
it "is valid" do
expect(card).to be_valid
end
it "is not valid without a title" do
expect(build(:widget_card, title: "")).not_to be_valid
end
end
describe "#header" do