]> git.openstreetmap.org Git - rails.git/commitdiff
Do validation in the :save context when testing email address validations
authorTom Hughes <tom@compton.nu>
Mon, 6 Dec 2010 23:03:20 +0000 (23:03 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 14 Nov 2011 09:42:46 +0000 (09:42 +0000)
test/unit/user_test.rb

index e537a8433aa97038c984dc7e189c385943980394..843c3190556724533757f73af2095e3254b1b89e 100644 (file)
@@ -48,13 +48,13 @@ class UserTest < ActiveSupport::TestCase
     ok.each do |name|
       user = users(:normal_user)
       user.email = name
-      assert user.valid?, user.errors.full_messages
+      assert user.valid?(:save), user.errors.full_messages
     end
     
     bad.each do |name|
       user = users(:normal_user)
       user.email = name
-      assert !user.valid?, "#{name} is valid when it shouldn't be" 
+      assert user.invalid?(:save), "#{name} is valid when it shouldn't be" 
     end
   end