aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-12-17 12:14:53 +0000
committerLouise Crow <louise.crow@gmail.com>2012-12-17 12:14:53 +0000
commitcfd458339e46bdeeaed8a4fe0ab27c3cafcd05f5 (patch)
tree289dc0060113f19cc309a465973e28c672ccff01
parente3dc628a38bb91b9d5e83971e247328bd421c47e (diff)
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.
-rw-r--r--spec/script/mailin-spec.rb21
1 files changed, 21 insertions, 0 deletions
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