diff options
Diffstat (limited to 'actionpack/test/template/erb')
-rw-r--r-- | actionpack/test/template/erb/form_for_test.rb | 11 | ||||
-rw-r--r-- | actionpack/test/template/erb/helper.rb | 24 | ||||
-rw-r--r-- | actionpack/test/template/erb/tag_helper_test.rb | 30 |
3 files changed, 0 insertions, 65 deletions
diff --git a/actionpack/test/template/erb/form_for_test.rb b/actionpack/test/template/erb/form_for_test.rb deleted file mode 100644 index e722b40a9a..0000000000 --- a/actionpack/test/template/erb/form_for_test.rb +++ /dev/null @@ -1,11 +0,0 @@ -require "abstract_unit" -require "template/erb/helper" - -module ERBTest - class TagHelperTest < BlockTestCase - test "form_for works" do - output = render_content "form_for(:staticpage, :url => {:controller => 'blah', :action => 'update'})", "" - assert_match %r{<form.*action="/blah/update".*method="post">.*</form>}, output - end - end -end diff --git a/actionpack/test/template/erb/helper.rb b/actionpack/test/template/erb/helper.rb deleted file mode 100644 index a1973068d5..0000000000 --- a/actionpack/test/template/erb/helper.rb +++ /dev/null @@ -1,24 +0,0 @@ -module ERBTest - class ViewContext - include ActionView::Helpers::UrlHelper - include SharedTestRoutes.url_helpers - include ActionView::Helpers::TagHelper - include ActionView::Helpers::JavaScriptHelper - include ActionView::Helpers::FormHelper - - attr_accessor :output_buffer, :controller - - def protect_against_forgery?() false end - end - - class BlockTestCase < ActiveSupport::TestCase - def render_content(start, inside) - template = block_helper(start, inside) - ActionView::Template::Handlers::Erubis.new(template).evaluate(ViewContext.new) - end - - def block_helper(str, rest) - "<%= #{str} do %>#{rest}<% end %>" - end - end -end diff --git a/actionpack/test/template/erb/tag_helper_test.rb b/actionpack/test/template/erb/tag_helper_test.rb deleted file mode 100644 index 84e328d8be..0000000000 --- a/actionpack/test/template/erb/tag_helper_test.rb +++ /dev/null @@ -1,30 +0,0 @@ -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 "<div>Hello world</div>", render_content("content_tag :div", "Hello world") - end - - test "percent equals works for javascript_tag" do - expected_output = "<script>\n//<![CDATA[\nalert('Hello')\n//]]>\n</script>" - 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\">\n//<![CDATA[\nalert('Hello')\n//]]>\n</script>" - 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>} - 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>" - assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>") - end - end -end |