aboutsummaryrefslogtreecommitdiffstats
path: root/spec/script/mailin_spec.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-03-19 14:52:55 -0700
committerLouise Crow <louise.crow@gmail.com>2013-03-19 14:52:55 -0700
commit0adcb32b81002528ea27855e2303118cbe9aefc1 (patch)
treec0f3efbf627045d9443e6ff3fadcb40e8e85dbdc /spec/script/mailin_spec.rb
parent844351acd314467dae44af0e10847dfd597fcc03 (diff)
parentf83b917ec2c59da0ce7c27da19b740366da58419 (diff)
Merge branch 'release/0.8'
Diffstat (limited to 'spec/script/mailin_spec.rb')
-rw-r--r--spec/script/mailin_spec.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/spec/script/mailin_spec.rb b/spec/script/mailin_spec.rb
index d80789635..acd06ff3b 100644
--- a/spec/script/mailin_spec.rb
+++ b/spec/script/mailin_spec.rb
@@ -4,7 +4,11 @@ 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))
+ mail = load_file_fixture(email_filename)
+ ir = info_requests(:other_request)
+ mail.gsub!('EMAIL_TO', ir.incoming_email)
+ mail.gsub!('EMAIL_FROM', 'responder@localhost')
+ xc.run(mail)
xc.err.should == ""
return xc
end
@@ -12,10 +16,22 @@ end
describe "When importing mail into the application" do
+ # Turn off transactional fixtures for this suite - incoming message is imported
+ # outside the transaction via ExternalCommand, so needs to be destroyed outside the
+ # transaction
+ self.use_transactional_fixtures = false
+
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 = mailin_test("incoming-request-empty.email")
r.status.should == 0
r.out.should == ""
end
-end \ No newline at end of file
+ # Destroy the incoming message so that it doesn't affect other tests
+ after do
+ ir = info_requests(:other_request)
+ incoming_message = ir.incoming_messages[0]
+ incoming_message.fully_destroy
+ end
+
+end