From 9ce9b4bcd06071cc6048cecb778efb59305f2c2e Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Thu, 26 May 2016 04:41:44 +0200 Subject: [PATCH] deliver profile update with new dispatcher --- app/models/user.rb | 2 +- spec/models/user/connecting_spec.rb | 4 +++- spec/models/user_spec.rb | 12 +++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 8e8060b6c..d21518479 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -416,7 +416,7 @@ class User < ActiveRecord::Base end def deliver_profile_update - Postzord::Dispatcher.build(self, profile).post + Diaspora::Federation::Dispatcher.defer_dispatch(self, profile) end def basic_profile_present? diff --git a/spec/models/user/connecting_spec.rb b/spec/models/user/connecting_spec.rb index 9647947b7..1161f9643 100644 --- a/spec/models/user/connecting_spec.rb +++ b/spec/models/user/connecting_spec.rb @@ -158,7 +158,9 @@ describe User::Connecting, type: :model do end it "posts profile" do - skip # TODO + allow(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch) + expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile) + alice.share_with(eve.person, alice.aspects.first) end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 70778223b..8b2170bcf 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -498,16 +498,14 @@ describe User, :type => :model do } end - it 'dispatches the profile when tags are set' do - @params = {:tag_string => '#what #hey'} - mailman = Postzord::Dispatcher.build(alice, Profile.new(person: alice.person)) - expect(Postzord::Dispatcher).to receive(:build).and_return(mailman) + it "dispatches the profile when tags are set" do + @params = {tag_string: '#what #hey'} + expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile) expect(alice.update_profile(@params)).to be true end - it 'sends a profile to their contacts' do - mailman = Postzord::Dispatcher.build(alice, Profile.new(person: alice.person)) - expect(Postzord::Dispatcher).to receive(:build).and_return(mailman) + it "sends a profile to their contacts" do + expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile) expect(alice.update_profile(@params)).to be true end