more first_name fixing
This commit is contained in:
parent
e71fcea762
commit
19897df1ec
2 changed files with 13 additions and 1 deletions
|
|
@ -154,7 +154,9 @@ class Person < ActiveRecord::Base
|
|||
self.diaspora_handle.split('@').first
|
||||
else
|
||||
names = profile.first_name.to_s.split(/\s/)
|
||||
names[0...-1].join(' ')
|
||||
str = names[0...-1].join(' ')
|
||||
str = names[0] if str.blank?
|
||||
str
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -281,6 +281,16 @@ describe Person do
|
|||
alice.person.profile.update_attributes(:first_name => "First Mid Last")
|
||||
alice.person.first_name.should == "First Mid"
|
||||
end
|
||||
|
||||
it 'returns first word in first_name if first_name is present' do
|
||||
alice.person.profile.update_attributes(:first_name => "Alice Smith")
|
||||
alice.person.first_name.should == "Alice"
|
||||
end
|
||||
|
||||
it 'returns first word in first_name if first_name is present' do
|
||||
alice.person.profile.update_attributes(:first_name => "Alice")
|
||||
alice.person.first_name.should == "Alice"
|
||||
end
|
||||
end
|
||||
|
||||
describe '.search' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue