aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/mail_handler/mail_handler_spec.rb
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-01-04 16:22:24 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-01-04 16:22:40 +1100
commit58defe7a49eda51676ffaa34ccf2b267d0e62159 (patch)
treef510d276e31f86abecab98d44282e1521c6916a0 /spec/lib/mail_handler/mail_handler_spec.rb
parentc9c599daacc54dcba508fa5868e3aef928b5670d (diff)
parent185c09f98dc670881239ecd230e47fb2f214e53b (diff)
Merge remote-tracking branch 'mysociety/develop' into rails-3-spike
Conflicts: Gemfile.lock Rakefile app/controllers/request_controller.rb lib/tasks/rspec.rake spec/controllers/services_controller_spec.rb spec/spec_helper.rb spec/views/request/_after_actions.rhtml_spec.rb
Diffstat (limited to 'spec/lib/mail_handler/mail_handler_spec.rb')
-rw-r--r--spec/lib/mail_handler/mail_handler_spec.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb
index ae65210f2..48c32e2bc 100644
--- a/spec/lib/mail_handler/mail_handler_spec.rb
+++ b/spec/lib/mail_handler/mail_handler_spec.rb
@@ -283,16 +283,20 @@ describe 'when getting attachment attributes' do
end
it 'should expand a mail attached as text' do
- mail = get_fixture_mail('rfc822-attachment.email')
- attributes = MailHandler.get_attachment_attributes(mail)
- attributes.size.should == 2
- rfc_attachment = attributes[1]
- rfc_attachment[:within_rfc822_subject].should == 'Freedom of Information request'
- headers = ['Date: Thu, 13 Mar 2008 16:57:33 +0000',
- 'Subject: Freedom of Information request',
- 'From: An FOI Officer <foi.officer@example.com>',
- 'To: request-bounce-xx-xxxxx@whatdotheyno.com']
- rfc_attachment[:body].should == "#{headers.join("\n")}\n\nsome example text"
+ # Note that this spec will only pass using Tmail in the timezone set as datetime headers
+ # are rendered out in the local time - using the Mail gem this is not necessary
+ with_env_tz('London') do
+ mail = get_fixture_mail('rfc822-attachment.email')
+ attributes = MailHandler.get_attachment_attributes(mail)
+ attributes.size.should == 2
+ rfc_attachment = attributes[1]
+ rfc_attachment[:within_rfc822_subject].should == 'Freedom of Information request'
+ headers = ['Date: Thu, 13 Mar 2008 16:57:33 +0000',
+ 'Subject: Freedom of Information request',
+ 'From: An FOI Officer <foi.officer@example.com>',
+ 'To: request-bounce-xx-xxxxx@whatdotheyno.com']
+ rfc_attachment[:body].should == "#{headers.join("\n")}\n\nsome example text"
+ end
end
it 'should handle a mail which causes Tmail to generate a blank header value' do