aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/email_helpers.rb
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-05-09 14:19:50 +0100
committerMark Longair <mhl@pobox.com>2013-05-16 09:06:27 +0100
commit9a5ef164ba29a8f56b3e2f42edf83d732613738f (patch)
tree9529a20008bfdcf8b0f60d8cc358503625958b73 /spec/support/email_helpers.rb
parent55fd2004f75b2c77c6f875aa5a392bb375f82657 (diff)
Switch to just loading fixtures in tests as binary strings
The data loaded with load_file_fixture is generally used in the tests as if it were binary data received from the MTA, so just load it as binary data - in Ruby 1.9 this means that it will end up with the encoding ASCII-8BIT. The same is the case when reading data from a fixture file in receive_incoming_mail.
Diffstat (limited to 'spec/support/email_helpers.rb')
-rw-r--r--spec/support/email_helpers.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/spec/support/email_helpers.rb b/spec/support/email_helpers.rb
index 7e98c39f6..252b1f137 100644
--- a/spec/support/email_helpers.rb
+++ b/spec/support/email_helpers.rb
@@ -8,7 +8,7 @@ end
def receive_incoming_mail(email_name, email_to, email_from = 'geraldinequango@localhost')
email_name = file_fixture_name(email_name)
- content = File.read(email_name)
+ content = File.open(email_name, 'rb') { |f| f.read }
content.gsub!('EMAIL_TO', email_to)
content.gsub!('EMAIL_FROM', email_from)
RequestMailer.receive(content)