aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/admin_request_controller_spec.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-05-29 08:51:17 +0100
committerSeb Bacon <seb.bacon@gmail.com>2012-05-29 08:51:17 +0100
commitb3cad7d37815a651bd10c6dfe3d91c3ff42f995d (patch)
tree5507ae010910ba5d3f6ecff77ccceb9ffd0082ea /spec/controllers/admin_request_controller_spec.rb
parente319d6c89acfad45f443a1a66c2b1bcf2672731c (diff)
Allow messages to be redelivered to more than one request. Closes #442
Diffstat (limited to 'spec/controllers/admin_request_controller_spec.rb')
-rw-r--r--spec/controllers/admin_request_controller_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb
index c6e3f2572..b0468822a 100644
--- a/spec/controllers/admin_request_controller_spec.rb
+++ b/spec/controllers/admin_request_controller_spec.rb
@@ -86,6 +86,27 @@ describe AdminRequestController, "when administering the holding pen" do
response.should redirect_to(:controller=>'admin_request', :action=>'show', :id=>101)
InfoRequest.holding_pen_request.incoming_messages.length.should == 0
end
+ it "allows redelivery to more than one request" do
+ ir1 = info_requests(:fancy_dog_request)
+ ir1.allow_new_responses_from = 'nobody'
+ ir1.handle_rejected_responses = 'holding_pen'
+ ir1.save!
+ ir1.incoming_messages.length.should == 1
+ ir2 = info_requests(:another_boring_request)
+ ir2.incoming_messages.length.should == 1
+
+ receive_incoming_mail('incoming-request-plain.email', ir1.incoming_email, "frob@nowhere.com")
+ InfoRequest.holding_pen_request.incoming_messages.length.should == 1
+
+ new_im = InfoRequest.holding_pen_request.incoming_messages[0]
+ post :redeliver_incoming, :redeliver_incoming_message_id => new_im.id, :url_title => "#{ir1.url_title},#{ir2.url_title}"
+ ir1.reload
+ ir1.incoming_messages.length.should == 2
+ ir2.reload
+ ir2.incoming_messages.length.should == 2
+ response.should redirect_to(:controller=>'admin_request', :action=>'show', :id=>ir2.id)
+ InfoRequest.holding_pen_request.incoming_messages.length.should == 0
+ end
it "guesses a misdirected request" do
ir = info_requests(:fancy_dog_request)