Commit dd777a433cf08d442605391ff7ae251bf2fff001
1 parent
9fe79d6f
Exists in
master
and in
29 other branches
ActionItem918: being tollerant to uncategorized friendship
Showing
2 changed files
with
7 additions
and
1 deletions
Show diff stats
app/models/person.rb
@@ -22,7 +22,7 @@ class Person < Profile | @@ -22,7 +22,7 @@ class Person < Profile | ||
22 | end | 22 | end |
23 | 23 | ||
24 | def suggested_friend_groups | 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 | end | 26 | end |
27 | 27 | ||
28 | def friend_groups | 28 | def friend_groups |
test/unit/person_test.rb
@@ -214,6 +214,12 @@ class PersonTest < Test::Unit::TestCase | @@ -214,6 +214,12 @@ class PersonTest < Test::Unit::TestCase | ||
214 | assert_equivalent [ 'friends', 'work', 'school', 'family', 'group1', 'group2' ], p.suggested_friend_groups | 214 | assert_equivalent [ 'friends', 'work', 'school', 'family', 'group1', 'group2' ], p.suggested_friend_groups |
215 | end | 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 | should 'list friend groups' do | 223 | should 'list friend groups' do |
218 | p1 = create_user('testuser1').person | 224 | p1 = create_user('testuser1').person |
219 | p2 = create_user('testuser2').person | 225 | p2 = create_user('testuser2').person |