From 42cdad422c119ca3eaf214dbe76fc01d784f56f9 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 15 Nov 2012 14:14:28 +0000 Subject: Use mail handler in handle-mail-replies.rb --- spec/script/handle-mail-replies_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'spec/script') diff --git a/spec/script/handle-mail-replies_spec.rb b/spec/script/handle-mail-replies_spec.rb index 406af9ee3..90a8de27c 100644 --- a/spec/script/handle-mail-replies_spec.rb +++ b/spec/script/handle-mail-replies_spec.rb @@ -5,7 +5,7 @@ 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 @@ -14,7 +14,7 @@ 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.run(load_file_fixture("track-response-exim-bounce.email")) xc.err.should == "" end @@ -23,19 +23,19 @@ describe "When filtering" do 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 -- cgit v1.2.3 From cfd458339e46bdeeaed8a4fe0ab27c3cafcd05f5 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Mon, 17 Dec 2012 12:14:53 +0000 Subject: Add a spec to test that mailin does not produce any output. This is important as under some MTA configurations, any output will result in a bounce message being sent to the original mail sender. --- spec/script/mailin-spec.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 spec/script/mailin-spec.rb (limited to 'spec/script') diff --git a/spec/script/mailin-spec.rb b/spec/script/mailin-spec.rb new file mode 100644 index 000000000..d80789635 --- /dev/null +++ b/spec/script/mailin-spec.rb @@ -0,0 +1,21 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require "external_command" + +def mailin_test(email_filename) + Dir.chdir Rails.root do + xc = ExternalCommand.new("script/mailin") + xc.run(load_file_fixture(email_filename)) + xc.err.should == "" + return xc + end +end + +describe "When importing mail into the application" do + + it "should not produce any output and should return a 0 code on importing a plain email" do + r = mailin_test("incoming-request-plain.email") + r.status.should == 0 + r.out.should == "" + end + +end \ No newline at end of file -- cgit v1.2.3