diff options
author | Jon Atack <jonnyatack@gmail.com> | 2014-12-16 17:33:53 +0100 |
---|---|---|
committer | Jon Atack <jonnyatack@gmail.com> | 2014-12-16 17:37:26 +0100 |
commit | 2038c2c53dafcebef32b4f1e31a97368b1b267e4 (patch) | |
tree | 7b8a758d6c222e7a1d3c36c953d7fc8c02f5d474 /actionview/test | |
parent | ab90c277a74b4b47a8d4cbef796c45d1a8b17cfd (diff) | |
download | rails-2038c2c53dafcebef32b4f1e31a97368b1b267e4.tar.gz rails-2038c2c53dafcebef32b4f1e31a97368b1b267e4.tar.bz2 rails-2038c2c53dafcebef32b4f1e31a97368b1b267e4.zip |
Test to ensure content_tag works when fixing #17661
After c2fe093, which was reverted yesterday, there will likely be
future PRs to address #17661.
The test `actionview/test/template/capture_helper_test.rb
#test_capture_returns_nil_if_the_returned_value_is_not_a_string` should
have errored with c2fe093, but it was rewritten in the PR to not raise.
My guess is that it may have seemed irrelevant to the content_tag tests
or already covered by them.
This test provides additional protection by being in the content_tag
test suite to explicitly raise a red flag in future cases. It foregoes
some redundancy for safety — at least until #17661 is closed.
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/tag_helper_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/actionview/test/template/tag_helper_test.rb b/actionview/test/template/tag_helper_test.rb index 7fc798dec9..d037447567 100644 --- a/actionview/test/template/tag_helper_test.rb +++ b/actionview/test/template/tag_helper_test.rb @@ -50,6 +50,11 @@ class TagHelperTest < ActionView::TestCase assert_dom_equal "<div>Hello world!</div>", buffer end + def test_content_tag_with_block_in_erb_containing_non_displayed_erb + buffer = render_erb("<%= content_tag(:p) do %><% 1 %><% end %>") + assert_dom_equal "<p></p>", buffer + end + def test_content_tag_with_block_and_options_in_erb buffer = render_erb("<%= content_tag(:div, :class => 'green') do %>Hello world!<% end %>") assert_dom_equal %(<div class="green">Hello world!</div>), buffer |