blob: 0ff094c2b34f4f7397c430e80d91fa31f5eae919 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require "external_command"
def mailin_test(email_filename)
Dir.chdir Rails.root do
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 = ExternalCommand.new("script/mailin", :stdin_string => mail).run
xc.err.should == ""
return xc
end
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-empty.email")
r.status.should == 0
r.out.should == ""
end
# 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
# And get rid of any remaining purge requests
PurgeRequest.destroy_all
end
end
|