bug fix: you can now mention and post a photo at the same time

This commit is contained in:
Maxwell Salzberg 2012-03-07 14:42:46 -08:00
parent 76450f7882
commit db0859a83c
2 changed files with 9 additions and 1 deletions

View file

@ -106,7 +106,7 @@ class StatusMessage < Post
def create_mentions
mentioned_people_from_string.each do |person|
self.mentions.create(:person => person)
self.mentions.find_or_create_by_person_id(person.id)
end
end

View file

@ -199,6 +199,14 @@ STR
@sm.create_mentions
@sm.mentions(true).map{|m| m.person}.to_set.should == @people.to_set
end
it 'does not barf if it gets called twice' do
@sm.create_mentions
expect{
@sm.create_mentions
}.should_not raise_error
end
end
describe '#mentioned_people' do
it 'calls create_mentions if there are no mentions in the db' do