diff options
author | tony <tony> | 2009-03-20 08:09:39 +0000 |
---|---|---|
committer | tony <tony> | 2009-03-20 08:09:39 +0000 |
commit | ebfefbb8aa3e74d9c7481027f60c07edffdc5285 (patch) | |
tree | ca9a52d8f37867eaf7dd02d2b6c9e4da159be79b /spec/models/user_spec.rb | |
parent | 853eb17fab5afeef822812a0b05c68de0790be34 (diff) |
add test for not allowing a user to use an email address as their name
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 69295bf72..52ec6e819 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -38,7 +38,6 @@ end describe User, " when saving" do before do @user = User.new - @user2 = User.new end it "should not save without setting some parameters" do @@ -52,6 +51,13 @@ describe User, " when saving" do lambda { @user.save! }.should raise_error(ActiveRecord::RecordInvalid) end + it "should not allow an email address as a name" do + @user.name = "silly@example.com" + @user.email = "silly@example.com" + @user.password = "insecurepassword" + lambda { @user.save! }.should raise_error(ActiveRecord::RecordInvalid) + end + it "should not save with no password" do @user.name = "Mr. Silly" @user.password = "" @@ -72,6 +78,7 @@ describe User, " when saving" do @user.email = "flobble@localhost" @user.save! + @user2 = User.new @user2.name = "Mr. Flobble" @user2.password = "insecurepassword" @user2.email = "flobble2@localhost" |