aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-10-09 18:26:22 +0100
committerLouise Crow <louise.crow@gmail.com>2012-10-09 18:26:22 +0100
commit83ba03721adb4b2446d38aaef9d11522d3a880dc (patch)
treedbc39556c84996dd67eedc87fd0ad7e2a57cfbb9 /spec/models
parent3c69d999dfdc09d8ad94c4d8e36c61b4fc0dd127 (diff)
Handle the case where an incoming message is badly encoded and has no charset on the part we're using as a main part.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/incoming_message_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index 03a3c8dc3..cf84b4595 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -56,6 +56,15 @@ describe IncomingMessage, " when dealing with incoming mail" do
message.subject.should == "Câmara Responde: Banco de ideias"
end
+ it 'should not error on display of a message which has no charset set on the body part and
+ is not good utf-8' do
+ ir = info_requests(:fancy_dog_request)
+ receive_incoming_mail('no-part-charset-bad-utf8.email', ir.incoming_email)
+ puts ir.incoming_messages.inspect
+ message = ir.incoming_messages[1]
+ message.parse_raw_email!
+ message.get_main_body_text_internal.should include("The above text was badly encoded")
+ end
it "should fold multiline sections" do
{
@@ -77,6 +86,7 @@ describe IncomingMessage, "when parsing HTML mail" do
plain_text = IncomingMessage._get_attachment_text_internal_one_file('text/html', html)
plain_text.should match(/është/)
end
+
end
describe IncomingMessage, "when getting the attachment text" do