tenderlove / rails_autolink

The auto_link function from Rails
MIT License
588 stars 91 forks source link

Tests failing? #69

Closed mmueller closed 2 years ago

mmueller commented 7 years ago

Do the tests pass for others here? When I run them, I see a bunch of failures (10 total, 4 included here):

10 failures:
# Running:
F.F.FF.F...F..FFF....F

Finished in 0.074736s, 294.3714 runs/s, 802.8312 assertions/s.

  1) Failure:
TestRailsAutolink#test_auto_link_should_sanitize_input_with_sanitize_options [/home/xxxxx/workplace-ruby/lib/rails_autolink/rails_autolink_test.rb:96]:

--- expected
+++ actual
@@ -1 +1 @@
-"<a class=\"big\" href=\"http://www.rubyonrails.com?id=1&num=2\">http://www.rubyonrails.com?id=1&num=2</a><a href=\"http://ruby-lang-org\" target=\"_blank\">Ruby</a>"
+"<a class=\"big\" href=\"http://www.rubyonrails.com?id=1&amp;num=2alert\">http://www.rubyonrails.com?id=1&amp;num=2alert</a>(\"malicious!\")<a href=\"http://ruby-lang-org\" target=\"_blank\">Ruby</a>"

  2) Failure:
TestRailsAutolink#test_auto_link_with_block [/home/xxxxx/workplace-ruby/lib/rails_autolink/rails_autolink_test.rb:67]:

--- expected
+++ actual
@@ -1 +1 @@
-"<p><a href=\"http://api.rubyonrails.com/Foo.html\">http://...</a><br /><a href=\"mailto:fantabulous@shiznadel.ic\">fantabu...</a><br /></p>"
+"<p><a href=\"http://api.rubyonrails.com/Foo.html\">http://...</a><br><a href=\"mailto:fantabulous@shiznadel.ic\">fantabu...</a><br></p>"

  3) Failure:
TestRailsAutolink#test_auto_link_email_addres_with_especial_chars [/home/xxxxx/workplace-ruby/lib/rails_autolink/rails_autolink_test.rb:190]:

--- expected
+++ actual
@@ -1 +1 @@
-"<a href=\"mailto:and&re$la*+r-a.o'rea=l~ly@tenderlovemaking.com\">and&amp;re$la*+r-a.o&#39;rea=l~ly@tenderlovemaking.com</a>"
+"and&amp;<a href=\"mailto:re%24la%2A%2Br-a.o%27rea%3Dl%7Ely@tenderlovemaking.com\">re$la*+r-a.o&#39;rea=l~ly@tenderlovemaking.com</a>"

  4) Failure:
TestRailsAutolink#test_auto_link_with_block_with_html [/home/xxxxx/workplace-ruby/lib/rails_autolink/rails_autolink_test.rb:74]:

--- expected
+++ actual
@@ -1 +1 @@
-"My pic: <a href=\"http://example.com/pic.png\"><img src=\"http://example.com/pic.png\" width=\"160px\"></a> -- full album here <a href=\"http://example.com/album?a&b=c\">http://example.com/album?a&b=c</a>"
+"My pic: <a href=\"http://example.com/pic.png\"><img src=\"http://example.com/pic.png\" width=\"160px\"></a> -- full album here <a href=\"http://example.com/album?a&amp;b=c\">http://example.com/album?a&amp;b=c</a>"

(This is after replacing the deprecated ActionDispatch DomAssertions with the rails-dom-testing version.)

jeremy commented 2 years ago

Fixed by #72.