]> git.openstreetmap.org Git - rails.git/blobdiff - test/models/user_test.rb
Convert test_friend_with to use factories, and use alice/bob/charlie for easier under...
[rails.git] / test / models / user_test.rb
index 3f66c5827460e96ab9b25e1a0cb7407f044d827d..dd2f9691d38432090760ec138b55e899d9b1144a 100644 (file)
@@ -108,13 +108,17 @@ class UserTest < ActiveSupport::TestCase
   end
 
   def test_friend_with
-    create(:friend, :befriender => users(:normal_user), :befriendee => users(:public_user))
-    assert users(:normal_user).is_friends_with?(users(:public_user))
-    assert !users(:normal_user).is_friends_with?(users(:inactive_user))
-    assert !users(:public_user).is_friends_with?(users(:normal_user))
-    assert !users(:public_user).is_friends_with?(users(:inactive_user))
-    assert !users(:inactive_user).is_friends_with?(users(:normal_user))
-    assert !users(:inactive_user).is_friends_with?(users(:public_user))
+    alice = create(:user, :active)
+    bob = create(:user, :active)
+    charlie = create(:user, :active)
+    create(:friend, :befriender => alice, :befriendee => bob)
+
+    assert alice.is_friends_with?(bob)
+    assert !alice.is_friends_with?(charlie)
+    assert !bob.is_friends_with?(alice)
+    assert !bob.is_friends_with?(charlie)
+    assert !charlie.is_friends_with?(bob)
+    assert !charlie.is_friends_with?(alice)
   end
 
   def test_users_nearby