Skip to content
Extraits de code Groupes Projets
Valider 153c4925 rédigé par maxwell's avatar maxwell
Parcourir les fichiers

test for pubsubhububb jobs

parent 7c3c17a4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module Jobs
class PublishToHub
require File.join(Rails.root, 'lib/pubsubhubbub')
def self.perform(sender_public_url)
PubSubHubbub.new(AppConfig[:pubsub_server]).publish(sender_public_url)
end
end
end
...@@ -45,7 +45,7 @@ class Postzord::Dispatch ...@@ -45,7 +45,7 @@ class Postzord::Dispatch
def deliver_to_hub def deliver_to_hub
Rails.logger.debug("event=post_to_service type=pubsub sender_handle=#{@sender.diaspora_handle}") Rails.logger.debug("event=post_to_service type=pubsub sender_handle=#{@sender.diaspora_handle}")
PubSubHubbub.new(AppConfig[:pubsub_server]).publish(@sender.public_url) Resque.enqueue(Jobs::PublishToHub, @sender.public_url)
end end
def deliver_to_services(url) def deliver_to_services(url)
......
...@@ -124,9 +124,9 @@ describe Postzord::Dispatch do ...@@ -124,9 +124,9 @@ describe Postzord::Dispatch do
@zord.send(:deliver_to_services, nil) @zord.send(:deliver_to_services, nil)
end end
it 'notifies the hub' do it 'queues a job to notify the hub' do
@zord.should_receive(:deliver_to_hub) Resque.should_receive(:enqueue).with(Jobs::PublishToHub, @user.public_url)
@zord.send(:deliver_to_services, nil) @zord.send(:deliver_to_services, nil)
end end
it 'only pushes to services if the object is public' do it 'only pushes to services if the object is public' do
......
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe Jobs::PublishToHub do
describe '.perform' do
it 'calls pubsubhubbub' do
url = "http://publiczone.com/"
m = mock()
m.should_receive(:publish).with(url)
PubSubHubbub.should_receive(:new).with(AppConfig[:pubsub_server]).and_return(m)
Jobs::PublishToHub.perform(url)
end
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter