deliver profile update with new dispatcher

This commit is contained in:
Benjamin Neff 2016-05-26 04:41:44 +02:00
parent caf5d562de
commit 9ce9b4bcd0
3 changed files with 9 additions and 9 deletions

View file

@ -416,7 +416,7 @@ class User < ActiveRecord::Base
end end
def deliver_profile_update def deliver_profile_update
Postzord::Dispatcher.build(self, profile).post Diaspora::Federation::Dispatcher.defer_dispatch(self, profile)
end end
def basic_profile_present? def basic_profile_present?

View file

@ -158,7 +158,9 @@ describe User::Connecting, type: :model do
end end
it "posts profile" do 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) alice.share_with(eve.person, alice.aspects.first)
end end
end end

View file

@ -498,16 +498,14 @@ describe User, :type => :model do
} }
end end
it 'dispatches the profile when tags are set' do it "dispatches the profile when tags are set" do
@params = {:tag_string => '#what #hey'} @params = {tag_string: '#what #hey'}
mailman = Postzord::Dispatcher.build(alice, Profile.new(person: alice.person)) expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile)
expect(Postzord::Dispatcher).to receive(:build).and_return(mailman)
expect(alice.update_profile(@params)).to be true expect(alice.update_profile(@params)).to be true
end end
it 'sends a profile to their contacts' do it "sends a profile to their contacts" do
mailman = Postzord::Dispatcher.build(alice, Profile.new(person: alice.person)) expect(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch).with(alice, alice.profile)
expect(Postzord::Dispatcher).to receive(:build).and_return(mailman)
expect(alice.update_profile(@params)).to be true expect(alice.update_profile(@params)).to be true
end end