diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-09-09 09:07:20 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-09-09 09:07:20 +0100 |
commit | b0181d36715c4e5258803c735b72a809b0f254a9 (patch) | |
tree | f7f496910e93213692b0ac295c08811ec03d1360 /spec/script/handle-mail-replies_spec.rb | |
parent | a9c7286807dca10872b5c659c216e1e2a754e9c3 (diff) | |
parent | e1d38525ae985d268a5d5478ed8122c5a5b19871 (diff) |
Merge origin/develop into local develop (including Nick's design changes)
Diffstat (limited to 'spec/script/handle-mail-replies_spec.rb')
-rw-r--r-- | spec/script/handle-mail-replies_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/script/handle-mail-replies_spec.rb b/spec/script/handle-mail-replies_spec.rb new file mode 100644 index 000000000..856476c3f --- /dev/null +++ b/spec/script/handle-mail-replies_spec.rb @@ -0,0 +1,33 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require "external_command" + +def mail_reply_test(email_filename) + Dir.chdir RAILS_ROOT do + xc = ExternalCommand.new("script/handle-mail-replies", "--test") + xc.run(load_file_fixture(email_filename)) + + xc.err.should == "" + return xc + end +end + +describe "When filtering" do + 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 pass on a non-bounce message" do + r = mail_reply_test("incoming-request-bad-uuencoding.email") + r.status.should == 0 + r.out.should == "" + end + + it "should detect a multipart bounce" do + r = mail_reply_test("track-response-multipart-report.email") + r.status.should == 1 + r.out.should == "FailedUser@example.com\n" + end +end + |