|
|
|
@ -39,11 +39,21 @@ class NormalizeUrlsFilterTest < MiniTest::Spec
|
|
|
|
|
assert_equal link_to(context[:url]), filter_output_string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "rewrites invalid relative urls" do
|
|
|
|
|
it "rewrites invalid link urls" do
|
|
|
|
|
@body = link_to '%'
|
|
|
|
|
assert_equal link_to('#'), filter_output_string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "rewrites invalid image urls" do
|
|
|
|
|
@body = '<img src="%">'
|
|
|
|
|
assert_equal '<img src="#">', filter_output_string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "doesn't rewrite invalid iframe urls" do
|
|
|
|
|
@body = '<iframe src="%"></iframe>'
|
|
|
|
|
assert_equal @body, filter_output_string
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "repairs un-encoded spaces" do
|
|
|
|
|
@body = link_to 'http://example.com/#foo bar '
|
|
|
|
|
assert_equal link_to('http://example.com/#foo%20bar'), filter_output_string
|
|
|
|
|