--amend
This commit is contained in:
parent
3fe30cde12
commit
80edb498f2
2 changed files with 0 additions and 42 deletions
|
|
@ -1,15 +0,0 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
module MessageHandler
|
||||
|
||||
NUM_TRIES = 3
|
||||
|
||||
def self.add_post_request(destinations, body)
|
||||
b = CGI::escape( body )
|
||||
[*destinations].each do |dest|
|
||||
Resque.enqueue(Jobs::HttpPost, dest, body, NUM_TRIES)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# 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 MessageHandler do
|
||||
let(:message_body) {"I want to pump you up"}
|
||||
let(:message_urls) {["http://www.google.com/", "http://yahoo.com/", "http://foo.com/"]}
|
||||
|
||||
describe 'POST messages' do
|
||||
before do
|
||||
@num_tries = MessageHandler::NUM_TRIES
|
||||
end
|
||||
it 'enqueues a POST' do
|
||||
Resque.should_receive(:enqueue).with(Jobs::HttpPost, message_urls.first, message_body, @num_tries)
|
||||
MessageHandler.add_post_request(message_urls.first, message_body)
|
||||
end
|
||||
|
||||
it 'enqueues multiple POSTs' do
|
||||
message_urls.each do |url|
|
||||
Resque.should_receive(:enqueue).with(Jobs::HttpPost, url, message_body, @num_tries).once
|
||||
end
|
||||
MessageHandler.add_post_request(message_urls, message_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue