diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-05-15 16:08:29 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-05-15 16:08:29 +0100 |
commit | 8c29864c8a84d0113209a33c4421abd10fd47c5b (patch) | |
tree | 88f709de47f12fd3f4b8f504c6e1f7c3fcc79d82 /spec/models/incoming_message_spec.rb | |
parent | 0eafdaa37f15f54a8229f9aacb5af6c4142d2009 (diff) | |
parent | 5dcbded2d03505d42b27e599e94306f51ba28e64 (diff) |
Merge branch 'multibyte-safe-slice' into rails-3-develop
Diffstat (limited to 'spec/models/incoming_message_spec.rb')
-rw-r--r-- | spec/models/incoming_message_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index f6e524de3..ca9bbe39e 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -707,3 +707,15 @@ describe IncomingMessage, 'when getting the body of a message for html display' end end + +describe IncomingMessage, 'when getting clipped attachment text' do + + it 'should clip to characters not bytes' do + incoming_message = FactoryGirl.build(:incoming_message) + # This character is 2 bytes so the string should get sliced unless + # we are handling multibyte chars correctly + multibyte_string = "å" * 500002 + incoming_message.stub!(:_get_attachment_text_internal).and_return(multibyte_string) + incoming_message.get_attachment_text_clipped.length.should == 500002 + end +end
\ No newline at end of file |