From c7bf30dc52cff299f4c89f3034c312559646c24f Mon Sep 17 00:00:00 2001 From: francis Date: Thu, 23 Apr 2009 14:07:19 +0000 Subject: Get multiline URLs right. --- spec/libs/format_spec.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'spec/libs/format_spec.rb') diff --git a/spec/libs/format_spec.rb b/spec/libs/format_spec.rb index a97e7cd9e..8f0ebbed9 100644 --- a/spec/libs/format_spec.rb +++ b/spec/libs/format_spec.rb @@ -22,4 +22,32 @@ More stuff and then another angle bracket >""" formatted.should == "<http://www.flourish.org/blog>\n\nMore stuff and then another angle bracket >" end + it "should make wrapped URLs in angle brackets clickable" do + text = """ Valid +request - name and address for correspondence + +If we can be of any further assistance please contact our Helpline on 08456 +30 60 60 or 01625 545745 if you would prefer to call a national rate number, +quoting your case reference number. You may also find some useful +information on our website at + www.ico.gov.uk.""" + text = CGI.escapeHTML(text) + formatted = MySociety::Format.make_clickable(text) + + expected_formatted = """<https://web.nhs.net/owa/redir.aspx?C=25a8af7e66054d62a435313f7f3d4694&URL=http%3a%2f%2fwww.ico.gov.uk%2fupload%2fdocuments%2flibrary%2ffreedom_of_information%2fdetailed_specialist_guides%2fname_of_applicant_fop083_v1.pdf> Valid +request - name and address for correspondence + +If we can be of any further assistance please contact our Helpline on 08456 +30 60 60 or 01625 545745 if you would prefer to call a national rate number, +quoting your case reference number. You may also find some useful +information on our website at +<https://web.nhs.net/owa/redir.aspx?C=25a8af7e66054d62a435313f7f3d4694&URL=http%3a%2f%2fwww.ico.gov.uk%2f> www.ico.gov.uk.""" + + formatted.should == expected_formatted + end + + end -- cgit v1.2.3