diff options
Diffstat (limited to 'actionview/test/template/erb/helper.rb')
-rw-r--r-- | actionview/test/template/erb/helper.rb | 24 |
1 files changed, 24 insertions, 0 deletions
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 |