favgroups: add stricter favgroup naming rules.
Don't allow favgroup names that: * Start or end with underscores. * Contain multiple underscores in a row. * Contain asterisks or non-printable characters. * Consist of only underscores. * Consist of only digits (conflicts with `favgroup:1234` syntax). Add a fix script that fixes favgroups that violate these rules and notifies the user.
This commit is contained in:
@@ -58,4 +58,15 @@ class FavoriteGroupTest < ActiveSupport::TestCase
|
||||
assert_equal([], @fav_group.reload.post_ids)
|
||||
end
|
||||
end
|
||||
|
||||
context "when validating names" do
|
||||
subject { build(:favorite_group) }
|
||||
|
||||
should_not allow_value("foo,bar").for(:name)
|
||||
should_not allow_value("foo*bar").for(:name)
|
||||
should_not allow_value("123").for(:name)
|
||||
should_not allow_value("_").for(:name)
|
||||
should_not allow_value("any").for(:name)
|
||||
should_not allow_value("none").for(:name)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user