From 924dc13adc69785ae6251b2ad70dc23767ce3f8f Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 17 Mar 2011 18:05:33 -0700 Subject: [PATCH] profile tagging now federates #FO #REAL --- app/models/profile.rb | 2 +- spec/integration/receiving_spec.rb | 13 +++++++++++++ spec/models/profile_spec.rb | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/models/profile.rb b/app/models/profile.rb index 0ad621fd4..c49601038 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -49,7 +49,7 @@ class Profile < ActiveRecord::Base def receive(user, person) Rails.logger.info("event=receive payload_type=profile sender=#{person} to=#{user}") - person.profile.update_attributes self.attributes + person.profile.update_attributes self.attributes.merge(:tag_string => self.tag_string) person.profile end diff --git a/spec/integration/receiving_spec.rb b/spec/integration/receiving_spec.rb index e8be6b4ab..61d31cc89 100644 --- a/spec/integration/receiving_spec.rb +++ b/spec/integration/receiving_spec.rb @@ -136,6 +136,19 @@ describe 'a user receives a post' do end end + describe 'profiles' do + it 'federates tags' do + luke, leia, raph = set_up_friends + raph.profile.diaspora_handle = "raph@remote.net" + raph.profile.save! + p = raph.profile + + p.tag_string = "#big #rafi #style" + p.receive(luke, raph) + p.tags(true).count.should == 3 + end + end + describe 'post refs' do before do @status_message = @user2.post :status_message, :text => "hi", :to => @aspect2.id diff --git a/spec/models/profile_spec.rb b/spec/models/profile_spec.rb index 3e74c921c..991111644 100644 --- a/spec/models/profile_spec.rb +++ b/spec/models/profile_spec.rb @@ -73,6 +73,20 @@ describe Profile do @profile.image_url.should == "http://not/a/relative/url" end end + + describe '#from_xml' do + it 'should make a valid profile object' do + + @profile = Factory.build(:profile) + @profile.tag_string = '#big #rafi #style' + xml = @profile.to_xml + + new_profile = Profile.from_xml(xml.to_s) + new_profile.tag_string.should_not be_blank + new_profile.tag_string.should include('#rafi') + end + end + describe 'serialization' do let(:person) {Factory.create(:person,:diaspora_handle => "foobar" )}