From ed3b240e211a56e38fc4c57d1fe6d7053f8fb47f Mon Sep 17 00:00:00 2001 From: francis Date: Tue, 21 Apr 2009 10:18:22 +0000 Subject: Fix bug with not escaping name when used in regexp. --- spec/models/incoming_message_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'spec/models') diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index d1738f6de..b84df3c0e 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -37,7 +37,26 @@ describe IncomingMessage, " display attachments" do foi_attachment.display_filename.should == expected_display_filename end +end + +describe IncomingMessage, " folding quoted parts of emails" do + + it "cope with [ in user names properly" do + @user = mock_model(User) + @user.stub!(:name).and_return("Sir [ Bobble") + @info_request = mock_model(InfoRequest) + @info_request.stub!(:user).and_return(@user) + + @incoming_message = IncomingMessage.new() + @incoming_message.info_request = @info_request + + # this gives a warning if [ is in the name + text = @incoming_message.remove_lotus_quoting("Sir [ Bobble \nSent by: \n") + text.should == "\n\nFOLDED_QUOTED_SECTION" + end end + + -- cgit v1.2.3