diff options
author | francis <francis> | 2009-04-23 13:25:33 +0000 |
---|---|---|
committer | francis <francis> | 2009-04-23 13:25:33 +0000 |
commit | 56e35fc775f6fefd706d74d325f2800172fe4c3c (patch) | |
tree | b09bc50c0c7a9b18429d5b7a9ee8338a06b7ea11 | |
parent | 9b3d6ddc404615b409853c86473df5e1c3a11138 (diff) |
Format (some) links in angle brackets that have newlines in them
-rw-r--r-- | spec/libs/format_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
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 <a href='http://www.flourish.org'>http://www.flourish.org</a> goodbye" + end + + it "should make wrapped URLs in angle brackets clickable" do + text = """<http://www.flourish.org/bl +og>""" + text = CGI.escapeHTML(text) + + formatted = MySociety::Format.make_clickable(text) + + formatted.should == "<<a href='http://www.flourish.org/blog'>http://www.flourish.org/blog</a>>" + end + +end |