Merge jdong
authorJohn Dong <jdong@mit.edu>
Wed, 29 Aug 2007 21:52:42 +0000 (17:52 -0400)
committerJohn Dong <jdong@mit.edu>
Wed, 29 Aug 2007 21:52:42 +0000 (17:52 -0400)
app/models/user.rb
test/functional/quickvote_controller_test.rb

index eca592dee17ef7082a09e21b6db191d38c8341f3..728ca164eee7fa87868f6fdb5fe1ba749440bcf5 100644 (file)
@@ -72,7 +72,7 @@ class User < ActiveRecord::Base
       # Stolen from http://www.regular-expressions.info/email.html
       errors.add(:email, "is not valid") unless email  =~
                   /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
-      errors.add(:login, "should not begin or end with spaces") if login.strip!
+      errors.add(:login, "should not begin or end with spaces") if login and login.strip!
       errors.add(:login, "should contain only letters, numbers, and spaces") unless login =~ /^[A-Za-z0-9 ]*$/
     end
 end
index ee79b3f50444e3902211b3d72fd5b5b379ecf5de..fbeb4a53a0dadf20ae1cd50be68fc41208ec1098 100644 (file)
@@ -43,19 +43,19 @@ class QuickvoteControllerTest < Test::Unit::TestCase
 
   def test_create_quickvote_badname
     post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candidate_names => ["foo", "bar", "foobar"]})
-    assert_template "quickvote/create"
+    assert_template "quickvote/_create_sidebar"
   end
 
   def test_create_quickvote_dupe_candidate
     post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candidate_names => ["foo", "bar", "bar",  "foobar"]})
-    assert_template "quickvote/create"
+    assert_template "quickvote/_create_sidebar"
   end
   
   def test_create_quickvote_nil_candidate
     post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candidate_names => nil})
-    assert_template "quickvote/create"
+    assert_template "quickvote/_create_sidebar"
     post(:create, {'commit' => "Create Quickvote", 'quickvote' => {'name' => "has a space", 'description' => "Foobar"}}, nil, {:candidate_names => []})
-    assert_template "quickvote/create"
+    assert_template "quickvote/_create_sidebar"
   end
 
   def test_get_quickvote_nonexistent

Benjamin Mako Hill || Want to submit a patch?