blob: cccd91a350de0597269dffe13ee755e78dc386dc (
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
|
require File.dirname(__FILE__) + '/../spec_helper'
describe RequestMailer, " when receiving incoming mail" do
fixtures :info_requests, :incoming_messages, :users, :public_bodies
before do
end
it "should append it to the appropriate request" do
ir = info_requests(:fancy_dog_request)
ir.incoming_messages.size.should == 1 # in the fixture
receive_incoming_mail('incoming-request-plain.email', ir.incoming_email)
ir.incoming_messages.size.should == 2 # one more arrives
end
it "should bounce email to admin when the email is not to any information request" do
ir = info_requests(:fancy_dog_request)
receive_incoming_mail('incoming-request-plain.email', 'dummy@localhost')
ir.incoming_messages.size.should == 1
deliveries = ActionMailer::Base.deliveries
deliveries.size.should == 1
mail = deliveries[0]
mail.to.should == [ MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost') ]
end
end
|