Add failing test for link_tags when streaming
This commit is contained in:
parent
0f3a895ee1
commit
f303eb2895
@ -6,9 +6,22 @@
|
|||||||
require "action_dispatch"
|
require "action_dispatch"
|
||||||
ActionView::Template::Types.delegate_to Mime
|
ActionView::Template::Types.delegate_to Mime
|
||||||
|
|
||||||
|
module AssetTagHelperTestHelpers
|
||||||
|
def with_preload_links_header(new_preload_links_header = true)
|
||||||
|
original_preload_links_header = ActionView::Helpers::AssetTagHelper.preload_links_header
|
||||||
|
ActionView::Helpers::AssetTagHelper.preload_links_header = new_preload_links_header
|
||||||
|
|
||||||
|
yield
|
||||||
|
ensure
|
||||||
|
ActionView::Helpers::AssetTagHelper.preload_links_header = original_preload_links_header
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class AssetTagHelperTest < ActionView::TestCase
|
class AssetTagHelperTest < ActionView::TestCase
|
||||||
tests ActionView::Helpers::AssetTagHelper
|
tests ActionView::Helpers::AssetTagHelper
|
||||||
|
|
||||||
|
include AssetTagHelperTestHelpers
|
||||||
|
|
||||||
attr_reader :request, :response
|
attr_reader :request, :response
|
||||||
|
|
||||||
class FakeRequest
|
class FakeRequest
|
||||||
@ -789,16 +802,6 @@ def test_caching_image_path_with_caching_and_proc_asset_host_using_request
|
|||||||
assert_equal "http://localhost/images/xml.png", image_path("xml.png")
|
assert_equal "http://localhost/images/xml.png", image_path("xml.png")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
def with_preload_links_header(new_preload_links_header = true)
|
|
||||||
original_preload_links_header = ActionView::Helpers::AssetTagHelper.preload_links_header
|
|
||||||
ActionView::Helpers::AssetTagHelper.preload_links_header = new_preload_links_header
|
|
||||||
|
|
||||||
yield
|
|
||||||
ensure
|
|
||||||
ActionView::Helpers::AssetTagHelper.preload_links_header = original_preload_links_header
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class AssetTagHelperNonVhostTest < ActionView::TestCase
|
class AssetTagHelperNonVhostTest < ActionView::TestCase
|
||||||
@ -952,6 +955,32 @@ def test_javascript_include_tag_without_request
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class AssetTagHelperWithStreamingRequest < ActionView::TestCase
|
||||||
|
tests ActionView::Helpers::AssetTagHelper
|
||||||
|
|
||||||
|
include AssetTagHelperTestHelpers
|
||||||
|
|
||||||
|
def setup
|
||||||
|
super
|
||||||
|
response.sending!
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_stylesheet_link_tag_with_streaming
|
||||||
|
with_preload_links_header do
|
||||||
|
assert_dom_equal(
|
||||||
|
%(<link rel="stylesheet" href="/stylesheets/foo.css" />),
|
||||||
|
stylesheet_link_tag("foo.css")
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_javascript_include_tag_with_streaming
|
||||||
|
with_preload_links_header do
|
||||||
|
assert_dom_equal %(<script src="/javascripts/foo.js"></script>), javascript_include_tag("foo.js")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class AssetUrlHelperControllerTest < ActionView::TestCase
|
class AssetUrlHelperControllerTest < ActionView::TestCase
|
||||||
tests ActionView::Helpers::AssetUrlHelper
|
tests ActionView::Helpers::AssetUrlHelper
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user