disallow whitespace in username
This commit is contained in:
parent
798d904e7e
commit
f688653936
3 changed files with 8 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue