From eb23754ebbfbf2d465cc0f900720704fb3703633 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 17 Apr 2013 00:06:11 +0200 Subject: Move template tests from actionpack to actionview --- actionview/test/template/erb/tag_helper_test.rb | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 actionview/test/template/erb/tag_helper_test.rb (limited to 'actionview/test/template/erb/tag_helper_test.rb') diff --git a/actionview/test/template/erb/tag_helper_test.rb b/actionview/test/template/erb/tag_helper_test.rb new file mode 100644 index 0000000000..84e328d8be --- /dev/null +++ b/actionview/test/template/erb/tag_helper_test.rb @@ -0,0 +1,30 @@ +require "abstract_unit" +require "template/erb/helper" + +module ERBTest + class TagHelperTest < BlockTestCase + test "percent equals works for content_tag and does not require parenthesis on method call" do + assert_equal "
Hello world
", render_content("content_tag :div", "Hello world") + end + + test "percent equals works for javascript_tag" do + expected_output = "" + assert_equal expected_output, render_content("javascript_tag", "alert('Hello')") + end + + test "percent equals works for javascript_tag with options" do + expected_output = "" + 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{.*hello*} + assert_match expected_output, render_content("form_tag('foo')", "<%= 'hello' %>") + end + + test "percent equals works with fieldset tags" do + expected_output = "
foohello
" + assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>") + end + end +end -- cgit v1.2.3