From 3ad8f0d7bf1a4e4ce5fedc1e4ffe0b22399d4822 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sat, 12 Sep 2020 06:49:10 +0100 Subject: [PATCH] Silence warnings about static path fallback We know they're going away but they still need testing for now. --- test/test_helper.rb | 260 ++++++++++++++++++++++++-------------------- 1 file changed, 140 insertions(+), 120 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 82876ec..1ed323d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -107,103 +107,115 @@ end class NoHostHelperTest < HelperTest def test_javascript_include_tag - assert_dom_equal %(), - @view.javascript_include_tag("static") - assert_dom_equal %(), - @view.javascript_include_tag("static.js") - assert_dom_equal %(), - @view.javascript_include_tag(:static) - - assert_dom_equal %(), - @view.javascript_include_tag("/elsewhere.js") - assert_dom_equal %(\n), - @view.javascript_include_tag("/script1.js", "script2.js") - - assert_dom_equal %(), - @view.javascript_include_tag("http://example.com/script") - assert_dom_equal %(), - @view.javascript_include_tag("http://example.com/script.js") - assert_dom_equal %(), - @view.javascript_include_tag("//example.com/script.js") - - assert_dom_equal %(), - @view.javascript_include_tag("static", :defer => "defer") - assert_dom_equal %(), - @view.javascript_include_tag("static", :async => "async") + ActiveSupport::Deprecation.silence do + assert_dom_equal %(), + @view.javascript_include_tag("static") + assert_dom_equal %(), + @view.javascript_include_tag("static.js") + assert_dom_equal %(), + @view.javascript_include_tag(:static) + + assert_dom_equal %(), + @view.javascript_include_tag("/elsewhere.js") + assert_dom_equal %(\n), + @view.javascript_include_tag("/script1.js", "script2.js") + + assert_dom_equal %(), + @view.javascript_include_tag("http://example.com/script") + assert_dom_equal %(), + @view.javascript_include_tag("http://example.com/script.js") + assert_dom_equal %(), + @view.javascript_include_tag("//example.com/script.js") + + assert_dom_equal %(), + @view.javascript_include_tag("static", :defer => "defer") + assert_dom_equal %(), + @view.javascript_include_tag("static", :async => "async") + end end def test_stylesheet_link_tag - assert_dom_equal %(), - @view.stylesheet_link_tag("static") - assert_dom_equal %(), - @view.stylesheet_link_tag("static.css") - assert_dom_equal %(), - @view.stylesheet_link_tag(:static) - - assert_dom_equal %(), - @view.stylesheet_link_tag("/elsewhere.css") - assert_dom_equal %(\n), - @view.stylesheet_link_tag("/style1.css", "style2.css") - - assert_dom_equal %(), - @view.stylesheet_link_tag("http://www.example.com/styles/style") - assert_dom_equal %(), - @view.stylesheet_link_tag("http://www.example.com/styles/style.css") - assert_dom_equal %(), - @view.stylesheet_link_tag("//www.example.com/styles/style.css") - - assert_dom_equal %(), - @view.stylesheet_link_tag("print", :media => "print") - assert_dom_equal %(), - @view.stylesheet_link_tag("print", :media => "") + ActiveSupport::Deprecation.silence do + assert_dom_equal %(), + @view.stylesheet_link_tag("static") + assert_dom_equal %(), + @view.stylesheet_link_tag("static.css") + assert_dom_equal %(), + @view.stylesheet_link_tag(:static) + + assert_dom_equal %(), + @view.stylesheet_link_tag("/elsewhere.css") + assert_dom_equal %(\n), + @view.stylesheet_link_tag("/style1.css", "style2.css") + + assert_dom_equal %(), + @view.stylesheet_link_tag("http://www.example.com/styles/style") + assert_dom_equal %(), + @view.stylesheet_link_tag("http://www.example.com/styles/style.css") + assert_dom_equal %(), + @view.stylesheet_link_tag("//www.example.com/styles/style.css") + + assert_dom_equal %(), + @view.stylesheet_link_tag("print", :media => "print") + assert_dom_equal %(), + @view.stylesheet_link_tag("print", :media => "") + end end def test_javascript_include_tag_integrity - assert_dom_equal %(), - @view.javascript_include_tag("static", integrity: "sha-256-TvVUHzSfftWg1rcfL6TIJ0XKEGrgLyEq6lEpcmrG9qs=") - - assert_dom_equal %(), - @view.javascript_include_tag("static", integrity: true) - assert_dom_equal %(), - @view.javascript_include_tag("static", integrity: false) - assert_dom_equal %(), - @view.javascript_include_tag("static", integrity: nil) + ActiveSupport::Deprecation.silence do + assert_dom_equal %(), + @view.javascript_include_tag("static", integrity: "sha-256-TvVUHzSfftWg1rcfL6TIJ0XKEGrgLyEq6lEpcmrG9qs=") + + assert_dom_equal %(), + @view.javascript_include_tag("static", integrity: true) + assert_dom_equal %(), + @view.javascript_include_tag("static", integrity: false) + assert_dom_equal %(), + @view.javascript_include_tag("static", integrity: nil) + end end def test_stylesheet_link_tag_integrity - assert_dom_equal %(), - @view.stylesheet_link_tag("static", integrity: "sha-256-5YzTQPuOJz/EpeXfN/+v1sxsjAj/dw8q26abiHZM3A4=") - - assert_dom_equal %(), - @view.stylesheet_link_tag("static", integrity: true) - assert_dom_equal %(), - @view.stylesheet_link_tag("static", integrity: false) + ActiveSupport::Deprecation.silence do + assert_dom_equal %(), + @view.stylesheet_link_tag("static", integrity: "sha-256-5YzTQPuOJz/EpeXfN/+v1sxsjAj/dw8q26abiHZM3A4=") + + assert_dom_equal %(), + @view.stylesheet_link_tag("static", integrity: true) + assert_dom_equal %(), + @view.stylesheet_link_tag("static", integrity: false) + end end def test_javascript_path - assert_equal "/javascripts/xmlhr.js", @view.javascript_path("xmlhr") - assert_equal "/javascripts/xmlhr.js", @view.javascript_path("xmlhr.js") - assert_equal "/javascripts/super/xmlhr.js", @view.javascript_path("super/xmlhr") - assert_equal "/super/xmlhr.js", @view.javascript_path("/super/xmlhr") - - assert_equal "/javascripts/xmlhr.js?foo=1", @view.javascript_path("xmlhr.js?foo=1") - assert_equal "/javascripts/xmlhr.js?foo=1", @view.javascript_path("xmlhr?foo=1") - assert_equal "/javascripts/xmlhr.js#hash", @view.javascript_path("xmlhr.js#hash") - assert_equal "/javascripts/xmlhr.js#hash", @view.javascript_path("xmlhr#hash") - assert_equal "/javascripts/xmlhr.js?foo=1#hash", @view.javascript_path("xmlhr.js?foo=1#hash") + ActiveSupport::Deprecation.silence do + assert_equal "/javascripts/xmlhr.js", @view.javascript_path("xmlhr") + assert_equal "/javascripts/xmlhr.js", @view.javascript_path("xmlhr.js") + assert_equal "/javascripts/super/xmlhr.js", @view.javascript_path("super/xmlhr") + assert_equal "/super/xmlhr.js", @view.javascript_path("/super/xmlhr") + + assert_equal "/javascripts/xmlhr.js?foo=1", @view.javascript_path("xmlhr.js?foo=1") + assert_equal "/javascripts/xmlhr.js?foo=1", @view.javascript_path("xmlhr?foo=1") + assert_equal "/javascripts/xmlhr.js#hash", @view.javascript_path("xmlhr.js#hash") + assert_equal "/javascripts/xmlhr.js#hash", @view.javascript_path("xmlhr#hash") + assert_equal "/javascripts/xmlhr.js?foo=1#hash", @view.javascript_path("xmlhr.js?foo=1#hash") + end end def test_stylesheet_path - assert_equal "/stylesheets/bank.css", @view.stylesheet_path("bank") - assert_equal "/stylesheets/bank.css", @view.stylesheet_path("bank.css") - assert_equal "/stylesheets/subdir/subdir.css", @view.stylesheet_path("subdir/subdir") - assert_equal "/subdir/subdir.css", @view.stylesheet_path("/subdir/subdir.css") - - assert_equal "/stylesheets/bank.css?foo=1", @view.stylesheet_path("bank.css?foo=1") - assert_equal "/stylesheets/bank.css?foo=1", @view.stylesheet_path("bank?foo=1") - assert_equal "/stylesheets/bank.css#hash", @view.stylesheet_path("bank.css#hash") - assert_equal "/stylesheets/bank.css#hash", @view.stylesheet_path("bank#hash") - assert_equal "/stylesheets/bank.css?foo=1#hash", @view.stylesheet_path("bank.css?foo=1#hash") + ActiveSupport::Deprecation.silence do + assert_equal "/stylesheets/bank.css", @view.stylesheet_path("bank") + assert_equal "/stylesheets/bank.css", @view.stylesheet_path("bank.css") + assert_equal "/stylesheets/subdir/subdir.css", @view.stylesheet_path("subdir/subdir") + assert_equal "/subdir/subdir.css", @view.stylesheet_path("/subdir/subdir.css") + + assert_equal "/stylesheets/bank.css?foo=1", @view.stylesheet_path("bank.css?foo=1") + assert_equal "/stylesheets/bank.css?foo=1", @view.stylesheet_path("bank?foo=1") + assert_equal "/stylesheets/bank.css#hash", @view.stylesheet_path("bank.css#hash") + assert_equal "/stylesheets/bank.css#hash", @view.stylesheet_path("bank#hash") + assert_equal "/stylesheets/bank.css?foo=1#hash", @view.stylesheet_path("bank.css?foo=1#hash") + end end end @@ -215,30 +227,34 @@ class NoSSLHelperTest < NoHostHelperTest end def test_javascript_include_tag_integrity - assert_dom_equal %(), - @view.javascript_include_tag("static", integrity: true) - assert_dom_equal %(), - @view.javascript_include_tag("static", integrity: false) - assert_dom_equal %(), - @view.javascript_include_tag("static", integrity: nil) - - assert_dom_equal %(), - @view.javascript_include_tag("static", integrity: "sha-256-TvVUHzSfftWg1rcfL6TIJ0XKEGrgLyEq6lEpcmrG9qs=") + ActiveSupport::Deprecation.silence do + assert_dom_equal %(), + @view.javascript_include_tag("static", integrity: true) + assert_dom_equal %(), + @view.javascript_include_tag("static", integrity: false) + assert_dom_equal %(), + @view.javascript_include_tag("static", integrity: nil) + + assert_dom_equal %(), + @view.javascript_include_tag("static", integrity: "sha-256-TvVUHzSfftWg1rcfL6TIJ0XKEGrgLyEq6lEpcmrG9qs=") + end assert_dom_equal %(), @view.javascript_include_tag("foo", integrity: true) end def test_stylesheet_link_tag_integrity - assert_dom_equal %(), - @view.stylesheet_link_tag("static", integrity: true) - assert_dom_equal %(), - @view.stylesheet_link_tag("static", integrity: false) - assert_dom_equal %(), - @view.stylesheet_link_tag("static", integrity: nil) - - assert_dom_equal %(), - @view.stylesheet_link_tag("static", integrity: "sha-256-5YzTQPuOJz/EpeXfN/+v1sxsjAj/dw8q26abiHZM3A4=") + ActiveSupport::Deprecation.silence do + assert_dom_equal %(), + @view.stylesheet_link_tag("static", integrity: true) + assert_dom_equal %(), + @view.stylesheet_link_tag("static", integrity: false) + assert_dom_equal %(), + @view.stylesheet_link_tag("static", integrity: nil) + + assert_dom_equal %(), + @view.stylesheet_link_tag("static", integrity: "sha-256-5YzTQPuOJz/EpeXfN/+v1sxsjAj/dw8q26abiHZM3A4=") + end assert_dom_equal %(), @view.stylesheet_link_tag("foo", integrity: true) @@ -302,16 +318,18 @@ class RelativeHostHelperTest < HelperTest end def test_javascript_path - assert_equal "https://assets.example.com/javascripts/xmlhr.js", @view.javascript_path("xmlhr") - assert_equal "https://assets.example.com/javascripts/xmlhr.js", @view.javascript_path("xmlhr.js") - assert_equal "https://assets.example.com/javascripts/super/xmlhr.js", @view.javascript_path("super/xmlhr") - assert_equal "https://assets.example.com/super/xmlhr.js", @view.javascript_path("/super/xmlhr") - - assert_equal "https://assets.example.com/javascripts/xmlhr.js?foo=1", @view.javascript_path("xmlhr.js?foo=1") - assert_equal "https://assets.example.com/javascripts/xmlhr.js?foo=1", @view.javascript_path("xmlhr?foo=1") - assert_equal "https://assets.example.com/javascripts/xmlhr.js#hash", @view.javascript_path("xmlhr.js#hash") - assert_equal "https://assets.example.com/javascripts/xmlhr.js#hash", @view.javascript_path("xmlhr#hash") - assert_equal "https://assets.example.com/javascripts/xmlhr.js?foo=1#hash", @view.javascript_path("xmlhr.js?foo=1#hash") + ActiveSupport::Deprecation.silence do + assert_equal "https://assets.example.com/javascripts/xmlhr.js", @view.javascript_path("xmlhr") + assert_equal "https://assets.example.com/javascripts/xmlhr.js", @view.javascript_path("xmlhr.js") + assert_equal "https://assets.example.com/javascripts/super/xmlhr.js", @view.javascript_path("super/xmlhr") + assert_equal "https://assets.example.com/super/xmlhr.js", @view.javascript_path("/super/xmlhr") + + assert_equal "https://assets.example.com/javascripts/xmlhr.js?foo=1", @view.javascript_path("xmlhr.js?foo=1") + assert_equal "https://assets.example.com/javascripts/xmlhr.js?foo=1", @view.javascript_path("xmlhr?foo=1") + assert_equal "https://assets.example.com/javascripts/xmlhr.js#hash", @view.javascript_path("xmlhr.js#hash") + assert_equal "https://assets.example.com/javascripts/xmlhr.js#hash", @view.javascript_path("xmlhr#hash") + assert_equal "https://assets.example.com/javascripts/xmlhr.js?foo=1#hash", @view.javascript_path("xmlhr.js?foo=1#hash") + end assert_dom_equal %(), @view.javascript_include_tag("foo") @@ -322,16 +340,18 @@ class RelativeHostHelperTest < HelperTest end def test_stylesheet_path - assert_equal "https://assets.example.com/stylesheets/bank.css", @view.stylesheet_path("bank") - assert_equal "https://assets.example.com/stylesheets/bank.css", @view.stylesheet_path("bank.css") - assert_equal "https://assets.example.com/stylesheets/subdir/subdir.css", @view.stylesheet_path("subdir/subdir") - assert_equal "https://assets.example.com/subdir/subdir.css", @view.stylesheet_path("/subdir/subdir.css") - - assert_equal "https://assets.example.com/stylesheets/bank.css?foo=1", @view.stylesheet_path("bank.css?foo=1") - assert_equal "https://assets.example.com/stylesheets/bank.css?foo=1", @view.stylesheet_path("bank?foo=1") - assert_equal "https://assets.example.com/stylesheets/bank.css#hash", @view.stylesheet_path("bank.css#hash") - assert_equal "https://assets.example.com/stylesheets/bank.css#hash", @view.stylesheet_path("bank#hash") - assert_equal "https://assets.example.com/stylesheets/bank.css?foo=1#hash", @view.stylesheet_path("bank.css?foo=1#hash") + ActiveSupport::Deprecation.silence do + assert_equal "https://assets.example.com/stylesheets/bank.css", @view.stylesheet_path("bank") + assert_equal "https://assets.example.com/stylesheets/bank.css", @view.stylesheet_path("bank.css") + assert_equal "https://assets.example.com/stylesheets/subdir/subdir.css", @view.stylesheet_path("subdir/subdir") + assert_equal "https://assets.example.com/subdir/subdir.css", @view.stylesheet_path("/subdir/subdir.css") + + assert_equal "https://assets.example.com/stylesheets/bank.css?foo=1", @view.stylesheet_path("bank.css?foo=1") + assert_equal "https://assets.example.com/stylesheets/bank.css?foo=1", @view.stylesheet_path("bank?foo=1") + assert_equal "https://assets.example.com/stylesheets/bank.css#hash", @view.stylesheet_path("bank.css#hash") + assert_equal "https://assets.example.com/stylesheets/bank.css#hash", @view.stylesheet_path("bank#hash") + assert_equal "https://assets.example.com/stylesheets/bank.css?foo=1#hash", @view.stylesheet_path("bank.css?foo=1#hash") + end assert_dom_equal %(), @view.stylesheet_link_tag("foo") -- 2.33.0