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/helper.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 actionview/test/template/erb/helper.rb (limited to 'actionview/test/template/erb/helper.rb') diff --git a/actionview/test/template/erb/helper.rb b/actionview/test/template/erb/helper.rb new file mode 100644 index 0000000000..a1973068d5 --- /dev/null +++ b/actionview/test/template/erb/helper.rb @@ -0,0 +1,24 @@ +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 -- cgit v1.2.3