require "test_helper" class RenderingHelperTest < ActionView::TestCase include RenderingHelper test "textile markup" do actual = render_text("This is *strong*.") assert_equal("

This is strong.

", actual) end test "onenote link" do url = 'onenote:///E:\OneNote\dir\notes.one#PAGE§ion-id={FD597D3A-3793-495F-8345-23D34A00DD3B}&page-id={1C95A1C7-6408-4804-B3B5-96C28426022B}&end' actual = render_text(url) expected = '

onenote:///E:\OneNote\dir\notes.one#PAGE&section-id={FD597D3A-3793-495F-8345-23D34A00DD3B}&page-id={1C95A1C7-6408-4804-B3B5-96C28426022B}&end

' assert_equal(expected, actual) end test "textile onenote link" do url = '"link me to onenote":onenote://foo/bar' actual = render_text(url) expected = '

link me to onenote

' assert_equal(expected, actual) end test "tagged onenote link" do actual = render_text('Link to onenote here.') assert_equal('

Link to onenote here.

', actual) end test "message link" do expected = '

Call message://<123>.

' actual = render_text("Call message://<123>.") assert_equal(expected, actual) end test "tagged message link" do expected = '

This message is already tagged: Call bob.

' actual = render_text(expected) assert_equal(expected, actual) end test "http link (in new window)" do actual = render_text("A link to http://github.com/.") expected = '

A link to http://github.com/.

' assert_equal(expected, actual) end test "http link (with double hyphens)" do skip("see issue #2056") actual = render_text("http://foo.bar/foo--bar") expected = '

http://foo.bar/foo--bar

' assert_equal(expected, actual) end test "textile http link" do actual = render_text('A link to "GitHub":http://github.com/.') expected = '

A link to GitHub.

' assert_equal(expected, actual) end test "textile http link (in new window)" do skip("see issue #2066") actual = render_text('A link to "GitHub":http://github.com/.') expected = '

A link to GitHub.

' assert_equal(expected, actual) end test "url with slash in query string" do # See http://blog.swivel.com/code/2009/06/rails-auto_link-and-certain-query-strings.html actual = render_text("foo http://example.com/foo?bar=/baz bar") expected = '

foo http://example.com/foo?bar=/baz bar

' assert_equal(expected, actual) end end