]> git.openstreetmap.org Git - rails.git/commitdiff
User factory for uniqueness tests
authorAndy Allan <git@gravitystorm.co.uk>
Thu, 2 Feb 2017 13:09:39 +0000 (13:09 +0000)
committerAndy Allan <git@gravitystorm.co.uk>
Thu, 2 Feb 2017 13:09:39 +0000 (13:09 +0000)
test/models/user_test.rb

index 90499e1b1f8167aa9f50fe2b4bdcbfef6272e2ad..3f66c5827460e96ab9b25e1a0cb7407f044d827d 100644 (file)
@@ -20,8 +20,9 @@ class UserTest < ActiveSupport::TestCase
   end
 
   def test_unique_email
+    existing_user = create(:user)
     new_user = User.new(
-      :email => users(:normal_user).email,
+      :email => existing_user.email,
       :status => "active",
       :pass_crypt => Digest::MD5.hexdigest("test"),
       :display_name => "new user",
@@ -33,11 +34,12 @@ class UserTest < ActiveSupport::TestCase
   end
 
   def test_unique_display_name
+    existing_user = create(:user)
     new_user = User.new(
       :email => "tester@openstreetmap.org",
       :status => "pending",
       :pass_crypt => Digest::MD5.hexdigest("test"),
-      :display_name => users(:normal_user).display_name,
+      :display_name => existing_user.display_name,
       :data_public => 1,
       :description => "desc"
     )