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(: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))
# inactive_user has no user nearby
assert_equal [], users(:inactive_user).nearby
# north_pole_user has no user nearby, and doesn't throw exception
# inactive_user has no user nearby
assert_equal [], users(:inactive_user).nearby
# north_pole_user has no user nearby, and doesn't throw exception
- # friend = Friend.new
- # friend.befriender = norm
- # friend.befriendee = sec
- # friend.save
- assert_equal [sec], norm.nearby
- assert_equal 1, norm.nearby.size
+ create(:friend, :befriender => norm, :befriendee => sec)
+ assert_equal 1, Friend.count
+ assert_equal [sec], norm.friend_users
+ assert_equal 1, norm.friend_users.size
assert_equal 1, Friend.count
assert norm.is_friends_with?(sec)
assert !sec.is_friends_with?(norm)
assert_equal 1, Friend.count
assert norm.is_friends_with?(sec)
assert !sec.is_friends_with?(norm)
+ create(:language, :code => "en")
+ create(:language, :code => "de")
+ create(:language, :code => "sl")
+
user = users(:normal_user)
assert_equal ["en"], user.languages
user.languages = %w(de fr en)
assert_equal %w(de fr en), user.languages
user.languages = %w(fr de sl)
assert_equal "de", user.preferred_language
user = users(:normal_user)
assert_equal ["en"], user.languages
user.languages = %w(de fr en)
assert_equal %w(de fr en), user.languages
user.languages = %w(fr de sl)
assert_equal "de", user.preferred_language
- assert_equal "de", user.preferred_language_from(%w(en sl de es))
+ assert_equal %w(fr de sl), user.preferred_languages.map(&:to_s)
+ user = users(:public_user)
+ assert_equal %w(en de), user.languages