diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-12-03 09:22:41 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-12-03 09:22:41 +0000 |
commit | 7414ed478f212be2b48c95fafde15726b348b197 (patch) | |
tree | 1d89b90f604b837b097fb4274775c4f3b3a319d6 /spec/mailers/request_mailer_spec.rb | |
parent | 479c9cd4567e2042d00c347f25a411373a6b1df9 (diff) | |
parent | d05082c1cf1ddec789e547b54943f6e7d5bdffc1 (diff) |
Merge branch 'release/0.20'0.20.0.0
Conflicts:
config/general.yml-example
Diffstat (limited to 'spec/mailers/request_mailer_spec.rb')
-rw-r--r-- | spec/mailers/request_mailer_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/mailers/request_mailer_spec.rb b/spec/mailers/request_mailer_spec.rb index 2c5d6e6a9..8ba2a7bec 100644 --- a/spec/mailers/request_mailer_spec.rb +++ b/spec/mailers/request_mailer_spec.rb @@ -38,6 +38,35 @@ describe RequestMailer, " when receiving incoming mail" do deliveries.clear end + it "should parse attachments from mails sent with apple mail" do + ir = info_requests(:fancy_dog_request) + ir.incoming_messages.size.should == 1 + InfoRequest.holding_pen_request.incoming_messages.size.should == 0 + receive_incoming_mail('apple-mail-with-attachments.email', 'dummy@localhost') + ir.incoming_messages.size.should == 1 + InfoRequest.holding_pen_request.incoming_messages.size.should == 1 + last_event = InfoRequest.holding_pen_request.incoming_messages[0].info_request.info_request_events.last + last_event.params[:rejected_reason].should == "Could not identify the request from the email address" + + im = IncomingMessage.last + # Check that the attachments haven't been somehow loaded from a + # previous test run + im.foi_attachments.size.should == 0 + + # Trace where attachments first get loaded: + # TODO: Ideally this should be 3, but some html parts from Apple Mail + # are being treated like attachments + im.extract_attachments! + im.foi_attachments.size.should == 6 + + # Clean up + deliveries = ActionMailer::Base.deliveries + deliveries.size.should == 1 + mail = deliveries[0] + mail.to.should == [ AlaveteliConfiguration::contact_email ] + deliveries.clear + end + it "should store mail in holding pen and send to admin when the from email is empty and only authorites can reply" do ir = info_requests(:fancy_dog_request) ir.allow_new_responses_from = 'authority_only' |