blob: f483605a4dd2735c9078a4c34341f98589530303 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
|