Skip to content
Snippets Groups Projects
Commit f6886539 authored by Sarah Mei's avatar Sarah Mei
Browse files

disallow whitespace in username

parent 798d904e
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,7 @@ class User
key :visible_person_ids, Array
validates_presence_of :username
validates_format_of :username, :without => /\s/
one :person, :class_name => 'Person', :foreign_key => :owner_id
......
......@@ -12,9 +12,9 @@ en:
user:
attributes:
username:
taken: "is already taken."
taken: "is already taken"
email:
taken: "is already taken."
taken: "is already taken"
hello: "Hello world"
application:
helper:
......
......@@ -52,6 +52,11 @@ describe User do
user.should be_valid
user.username.should == "janie"
end
it "fails if there's whitespace in the middle" do
user = Factory.build(:user, :username => "bobby tables")
user.should_not be_valid
end
end
describe "of email" do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment