Commit dd777a433cf08d442605391ff7ae251bf2fff001

Authored by Antonio Terceiro
1 parent 9fe79d6f

ActionItem918: being tollerant to uncategorized friendship

app/models/person.rb
... ... @@ -22,7 +22,7 @@ class Person < Profile
22 22 end
23 23  
24 24 def suggested_friend_groups
25   - (friend_groups + [ _('friends'), _('work'), _('school'), _('family') ]).map {|i| i if !i.empty?}.compact.uniq
  25 + (friend_groups.compact + [ _('friends'), _('work'), _('school'), _('family') ]).map {|i| i if !i.empty?}.compact.uniq
26 26 end
27 27  
28 28 def friend_groups
... ...
test/unit/person_test.rb
... ... @@ -214,6 +214,12 @@ class PersonTest < Test::Unit::TestCase
214 214 assert_equivalent [ 'friends', 'work', 'school', 'family', 'group1', 'group2' ], p.suggested_friend_groups
215 215 end
216 216  
  217 + should 'accept nil friend groups when suggesting friend groups' do
  218 + p = Person.new(:environment => Environment.default)
  219 + p.expects(:friend_groups).returns([nil])
  220 + assert_equivalent [ 'friends', 'work', 'school', 'family' ], p.suggested_friend_groups
  221 + end
  222 +
217 223 should 'list friend groups' do
218 224 p1 = create_user('testuser1').person
219 225 p2 = create_user('testuser2').person
... ...