diff options
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/capture_helper_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/erb/tag_helper_test.rb | 44 | ||||
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 5 | ||||
-rw-r--r-- | actionpack/test/template/render_test.rb | 9 |
4 files changed, 14 insertions, 46 deletions
diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index f7c42c7f22..8f81076299 100644 --- a/actionpack/test/template/capture_helper_test.rb +++ b/actionpack/test/template/capture_helper_test.rb @@ -15,7 +15,6 @@ class CaptureHelperTest < ActionView::TestCase end assert_nil @av.output_buffer assert_equal 'foobar', string - assert_kind_of ActionView::NonConcattingString, string end def test_capture_captures_the_value_returned_by_the_block_if_the_temporary_buffer_is_blank @@ -23,7 +22,6 @@ class CaptureHelperTest < ActionView::TestCase a + b end assert_equal 'foobar', string - assert_kind_of ActionView::NonConcattingString, string end def test_capture_returns_nil_if_the_returned_value_is_not_a_string diff --git a/actionpack/test/template/erb/tag_helper_test.rb b/actionpack/test/template/erb/tag_helper_test.rb index d073100986..036f3a3cc9 100644 --- a/actionpack/test/template/erb/tag_helper_test.rb +++ b/actionpack/test/template/erb/tag_helper_test.rb @@ -2,59 +2,35 @@ require "abstract_unit" require "template/erb/helper" module ERBTest - module SharedTagHelpers - extend ActiveSupport::Testing::Declarative - - def maybe_deprecated - if @deprecated - assert_deprecated { yield } - else - yield - end + class TagHelperTest < BlockTestCase + def block_helper(str, rest) + "<%= #{str} do %>#{rest}<% end %>" end + extend ActiveSupport::Testing::Declarative + test "percent equals works for content_tag and does not require parenthesis on method call" do - maybe_deprecated { assert_equal "<div>Hello world</div>", render_content("content_tag :div", "Hello world") } + assert_equal "<div>Hello world</div>", render_content("content_tag :div", "Hello world") end test "percent equals works for javascript_tag" do expected_output = "<script type=\"text/javascript\">\n//<![CDATA[\nalert('Hello')\n//]]>\n</script>" - maybe_deprecated { assert_equal expected_output, render_content("javascript_tag", "alert('Hello')") } + assert_equal expected_output, render_content("javascript_tag", "alert('Hello')") end test "percent equals works for javascript_tag with options" do expected_output = "<script id=\"the_js_tag\" type=\"text/javascript\">\n//<![CDATA[\nalert('Hello')\n//]]>\n</script>" - maybe_deprecated { assert_equal expected_output, render_content("javascript_tag(:id => 'the_js_tag')", "alert('Hello')") } + assert_equal expected_output, render_content("javascript_tag(:id => 'the_js_tag')", "alert('Hello')") end test "percent equals works with form tags" do expected_output = %r{<form.*action="foo".*method="post">.*hello*</form>} - maybe_deprecated { assert_match expected_output, render_content("form_tag('foo')", "<%= 'hello' %>") } + assert_match expected_output, render_content("form_tag('foo')", "<%= 'hello' %>") end test "percent equals works with fieldset tags" do expected_output = "<fieldset><legend>foo</legend>hello</fieldset>" - maybe_deprecated { assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>") } + assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>") end end - - class TagHelperTest < BlockTestCase - def block_helper(str, rest) - "<%= #{str} do %>#{rest}<% end %>" - end - - include SharedTagHelpers - end - - class DeprecatedTagHelperTest < BlockTestCase - def block_helper(str, rest) - "<% __in_erb_template=true %><% #{str} do %>#{rest}<% end %>" - end - - def setup - @deprecated = true - end - - include SharedTagHelpers - end end
\ No newline at end of file diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 8ba4aa1639..fd801e2a9e 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -167,7 +167,10 @@ class FormHelperTest < ActionView::TestCase '<input id="post_title" name="post[title]" size="30" type="text" value="Hello World" />', text_field("post", "title") ) assert_dom_equal( - '<input id="post_title" name="post[title]" size="30" type="password" value="Hello World" />', password_field("post", "title") + '<input id="post_title" name="post[title]" size="30" type="password" />', password_field("post", "title") + ) + assert_dom_equal( + '<input id="post_title" name="post[title]" size="30" type="password" value="Hello World" />', password_field("post", "title", :value => @post.title) ) assert_dom_equal( '<input id="person_name" name="person[name]" size="30" type="password" />', password_field("person", "name") diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index 60d4d9f4a7..229766612f 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -234,15 +234,6 @@ module RenderTestCases @view.render(:file => "test/hello_world.erb", :layout => "layouts/yield_with_render_inline_inside") end - - # TODO: Move to deprecated_tests.rb - def test_render_with_nested_layout_deprecated - assert_deprecated do - assert_equal %(<title>title</title>\n\n<div id="column">column</div>\n<div id="content">content</div>\n), - @view.render(:file => "test/deprecated_nested_layout.erb", :layout => "layouts/yield") - end - end - def test_render_with_nested_layout assert_equal %(<title>title</title>\n\n<div id="column">column</div>\n<div id="content">content</div>\n), @view.render(:file => "test/nested_layout.erb", :layout => "layouts/yield") |