diff options
-rw-r--r-- | app/controllers/admin_request_controller.rb | 2 | ||||
-rw-r--r-- | spec/controllers/admin_request_controller_spec.rb | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb index b3fb1ce40..e5de4f8b7 100644 --- a/app/controllers/admin_request_controller.rb +++ b/app/controllers/admin_request_controller.rb @@ -296,7 +296,7 @@ class AdminRequestController < AdminController @info_requests = InfoRequest.guess_by_incoming_email(@raw_email.incoming_message) # 3. Give a reason why it's in the holding pen - last_event = @raw_email.incoming_message.info_request.get_last_event + last_event = InfoRequestEvent.find_by_incoming_message_id(@raw_email.incoming_message.id) @rejected_reason = last_event.params[:rejected_reason] end end diff --git a/spec/controllers/admin_request_controller_spec.rb b/spec/controllers/admin_request_controller_spec.rb index ee0acb637..423c2fb49 100644 --- a/spec/controllers/admin_request_controller_spec.rb +++ b/spec/controllers/admin_request_controller_spec.rb @@ -78,10 +78,15 @@ describe AdminRequestController, "when administering the holding pen" do it "guesses a misdirected request" do ir = info_requests(:fancy_dog_request) ir.handle_rejected_responses = 'holding_pen' + ir.allow_new_responses_from = 'authority_only' ir.save! mail_to = "request-#{ir.id}-asdfg@example.com" receive_incoming_mail('incoming-request-plain.email', mail_to) - get :show_raw_email, :id => InfoRequest.holding_pen_request.get_last_response.raw_email.id + interesting_email = InfoRequest.holding_pen_request.get_last_response.raw_email.id + # now we add another message to the queue, which we're not interested in + receive_incoming_mail('incoming-request-plain.email', ir.incoming_email, "") + InfoRequest.holding_pen_request.incoming_messages.length.should == 2 + get :show_raw_email, :id => interesting_email response.should have_text(/Could not identify the request/) assigns[:info_requests][0].should == ir end |