diff options
Diffstat (limited to 'spec/script/handle-mail-replies_spec.rb')
-rw-r--r-- | spec/script/handle-mail-replies_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/script/handle-mail-replies_spec.rb b/spec/script/handle-mail-replies_spec.rb index 8ed83b31f..406af9ee3 100644 --- a/spec/script/handle-mail-replies_spec.rb +++ b/spec/script/handle-mail-replies_spec.rb @@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require "external_command" def mail_reply_test(email_filename) - Dir.chdir RAILS_ROOT do + Dir.chdir Rails.root do xc = ExternalCommand.new("script/handle-mail-replies", "--test") xc.run(load_file_fixture(email_filename)) @@ -12,12 +12,30 @@ def mail_reply_test(email_filename) end describe "When filtering" do + it "should not fail when not in test mode" do + xc = ExternalCommand.new("script/handle-mail-replies") + xc.run(load_file_fixture("track-response-exim-bounce.email")) + xc.err.should == "" + end + it "should detect an Exim bounce" do r = mail_reply_test("track-response-exim-bounce.email") r.status.should == 1 r.out.should == "user@example.com\n" end + it "should detect a WebShield delivery error message" do + r = mail_reply_test("track-response-webshield-bounce.email") + r.status.should == 1 + r.out.should == "failed.user@example.co.uk\n" + end + + it "should detect a MS Exchange non-permanent delivery error message" do + r = mail_reply_test("track-response-ms-bounce.email") + r.status.should == 1 + r.out.should == "" + end + it "should pass on a non-bounce message" do r = mail_reply_test("incoming-request-bad-uuencoding.email") r.status.should == 0 |