Skip to content
Extraits de code Groupes Projets
Valider 8a2e0eef rédigé par Raphael's avatar Raphael
Parcourir les fichiers

No semicolons in names

parent 7bfaf462
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -23,6 +23,8 @@ class Profile < ActiveRecord::Base
validates_length_of :first_name, :maximum => 32
validates_length_of :last_name, :maximum => 32
validates_format_of :first_name, :with => /\A[^;]+\z/
validates_format_of :last_name, :with => /\A[^;]+\z/
attr_accessible :first_name, :last_name, :image_url, :image_url_medium,
:image_url_small, :birthday, :gender, :bio, :searchable, :date
......
......@@ -22,6 +22,10 @@ describe Profile do
profile = Factory.build(:profile, :first_name => "Hexagooooooooooooooooooooooooooon")
profile.should_not be_valid
end
it 'cannot have ;' do
profile = Factory.build(:profile, :first_name => "Hex;agon")
profile.should_not be_valid
end
end
describe "of last_name" do
it "strips leading and trailing whitespace" do
......@@ -39,6 +43,15 @@ describe Profile do
profile = Factory.build(:profile, :last_name => "Hexagooooooooooooooooooooooooooon")
profile.should_not be_valid
end
it 'cannot have ;' do
profile = Factory.build(:profile, :last_name => "Hex;agon")
profile.should_not be_valid
end
it 'disallows ; with a newline in the string' do
profile = Factory.build(:profile, :last_name => "H\nex;agon")
profile.should_not be_valid
end
end
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter