blob: a97e7cd9e0b23e98b1173443ecc08226482e4939 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
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.flou
rish.org/bl
og>
More stuff and then another angle bracket >"""
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>>\n\nMore stuff and then another angle bracket >"
end
end
|