From 2f89f19f34d879b27f5b1537d42edc5d4a9a19bb Mon Sep 17 00:00:00 2001
From: Ryan Hughes <ryan@iheartryan.com>
Date: Mon, 4 Jul 2011 15:43:35 -0700
Subject: [PATCH] Test sending to people with bad rsa keys.

---
 spec/models/jobs/http_multi_spec.rb | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/spec/models/jobs/http_multi_spec.rb b/spec/models/jobs/http_multi_spec.rb
index b209aa5241..501fcf9229 100644
--- a/spec/models/jobs/http_multi_spec.rb
+++ b/spec/models/jobs/http_multi_spec.rb
@@ -80,4 +80,17 @@ describe Job::HttpMulti do
     person.reload
     person.url.should == "https://remote.net/"
   end
+
+  it 'only sends to users with valid RSA keys' do
+    person = @people[0]
+    person.serialized_public_key = "-----BEGIN RSA PUBLIC KEY-----\nPsych!\n-----END RSA PUBLIC KEY-----"
+    person.save
+
+    @hydra.stub(:post, @people[0].receive_url).and_return(@response)
+    @hydra.stub(:post, @people[1].receive_url).and_return(@response)
+    Typhoeus::Hydra.stub!(:new).and_return(@hydra)
+
+    @hydra.should_receive(:queue).once
+    Job::HttpMulti.perform(bob.id, @post_xml, [@people[0].id, @people[1].id])
+  end
 end
-- 
GitLab