From 457c876b15640d79f4398c3facb8652210d7c2e0 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 14 Sep 2014 06:51:29 +0930 Subject: Revert "Merge pull request #15312 from JuanitoFatas/action_view/asset_path" This reverts commit 21ec7fefea5a1b823cb88733b019b3d52240801d. Per #16911, there's actually a good reason for a "blank" value to have a useful `to_s` here. So let's also add some tests to prove that. --- actionview/test/template/asset_tag_helper_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'actionview/test') diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index d789a5ca27..df8547ef85 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -535,6 +535,17 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal copy, source end + class PlaceholderImage + def blank?; true; end + def to_s; 'no-image-yet.png'; end + end + def test_image_tag_with_blank_placeholder + assert_equal '', image_tag(PlaceholderImage.new, alt: "") + end + def test_image_path_with_blank_placeholder + assert_equal '/images/no-image-yet.png', image_path(PlaceholderImage.new) + end + def test_image_path_with_asset_host_proc_returning_nil @controller.config.asset_host = Proc.new do |source| unless source.end_with?("tiff") -- cgit v1.2.3