stubbing out the hub publish method
This commit is contained in:
parent
47a9b2d189
commit
c6fbcd28f7
4 changed files with 11 additions and 3 deletions
|
|
@ -1,4 +1,6 @@
|
|||
class Notifier < ActionMailer::Base
|
||||
include Magent::Async
|
||||
|
||||
default :from => "no-reply@joindiaspora.com"
|
||||
ATTACHMENT = File.read("#{Rails.root}/public/images/diaspora_caps.png")
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ module Diaspora
|
|||
activate_friend(friend_request.person, destination_aspect)
|
||||
Rails.logger.info("#{self.real_name}'s friend request has been accepted")
|
||||
friend_request.destroy
|
||||
Notifier.request_accepted(self, friend_request.person, destination_aspect).deliver
|
||||
Notifier.async.request_accepted(self, friend_request.person, destination_aspect).deliver.commit(1)
|
||||
|
||||
#this is a new friend request
|
||||
elsif !from_me
|
||||
|
|
@ -80,7 +80,7 @@ module Diaspora
|
|||
self.save
|
||||
Rails.logger.info("#{self.real_name} has received a friend request")
|
||||
friend_request.save
|
||||
Notifier.new_request(self, friend_request.person).deliver
|
||||
Notifier.async.new_request(self, friend_request.person).deliver.commit(1)
|
||||
else
|
||||
Rails.logger.info("unsolicited friend request: #{friend_request.to_json}")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ describe MessageHandler do
|
|||
end
|
||||
|
||||
describe 'POST messages' do
|
||||
|
||||
it 'should be able to add a post message to the queue' do
|
||||
EventMachine.run {
|
||||
@handler.size.should ==0
|
||||
|
|
@ -103,6 +102,9 @@ describe MessageHandler do
|
|||
end
|
||||
|
||||
describe "Hub publish" do
|
||||
before do
|
||||
EventMachine::PubSubHubbub.stub(:new).and_return(:success)
|
||||
end
|
||||
it 'should correctly queue up a pubsubhubbub publish request' do
|
||||
destination = "http://identi.ca/hub/"
|
||||
feed_location = "http://google.com/"
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ class FakeHttpRequest
|
|||
self
|
||||
end
|
||||
|
||||
def publish(opts = nil)
|
||||
self
|
||||
end
|
||||
|
||||
def callback(&b)
|
||||
b.call if @callback == :success
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue