From 56e35fc775f6fefd706d74d325f2800172fe4c3c Mon Sep 17 00:00:00 2001 From: francis Date: Thu, 23 Apr 2009 13:25:33 +0000 Subject: Format (some) links in angle brackets that have newlines in them --- spec/libs/format_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 spec/libs/format_spec.rb (limited to 'spec/libs/format_spec.rb') diff --git a/spec/libs/format_spec.rb b/spec/libs/format_spec.rb new file mode 100644 index 000000000..f483605a4 --- /dev/null +++ b/spec/libs/format_spec.rb @@ -0,0 +1,22 @@ +require File.dirname(__FILE__) + '/../spec_helper' + +describe "when making clickable" do + + it "should make URLs into links" do + text = "Hello http://www.flourish.org goodbye" + text = CGI.escapeHTML(text) + formatted = MySociety::Format.make_clickable(text) + formatted.should == "Hello http://www.flourish.org goodbye" + end + + it "should make wrapped URLs in angle brackets clickable" do + text = """""" + text = CGI.escapeHTML(text) + + formatted = MySociety::Format.make_clickable(text) + + formatted.should == "<http://www.flourish.org/blog>" + end + +end -- cgit v1.2.3