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
def deliver_profile_update
Postzord::Dispatcher.build(self, profile).post
Diaspora::Federation::Dispatcher.defer_dispatch(self, profile)
end
def basic_profile_present?

View file

@ -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

View file

@ -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