3 class RelationMemberTest < ActiveSupport::TestCase
4 def test_role_with_invalid_characters
5 invalid = ["\x7f<hr/>", "test@example.com\x0e-", "s/\x1ff", "aa/\ufffe",
6 "aa\x0b-,", "aa?\x08", "/;\uffff.,?", "\x0c#ping",
7 "foo\x1fbar", "foo\x7fbar", "foo\ufffebar", "foo\uffffbar"]
8 relation = create(:relation)
11 member = build(:relation_member, :relation => relation, :member => node, :member_role => r)
12 assert_not member.valid?, "'#{r}' should not be valid"
13 assert_predicate member.errors[:member_role], :any?
17 def test_role_too_long
18 relation = create(:relation)
20 member = build(:relation_member, :relation => relation, :member => node, :member_role => "r" * 256)
21 assert_not member.valid?, "Role should be too long"
22 assert_predicate member.errors[:member_role], :any?