2010-03-17 19:28:05 -04:00
|
|
|
module ERBTest
|
|
|
|
class ViewContext
|
2012-06-21 12:39:35 -04:00
|
|
|
include ActionView::Helpers::UrlHelper
|
2010-04-03 05:30:06 -04:00
|
|
|
include SharedTestRoutes.url_helpers
|
2010-03-17 19:28:05 -04:00
|
|
|
include ActionView::Helpers::TagHelper
|
|
|
|
include ActionView::Helpers::JavaScriptHelper
|
|
|
|
include ActionView::Helpers::FormHelper
|
|
|
|
|
2010-04-03 05:30:06 -04:00
|
|
|
attr_accessor :output_buffer, :controller
|
2010-03-17 19:28:05 -04:00
|
|
|
|
|
|
|
def protect_against_forgery?() false end
|
|
|
|
end
|
|
|
|
|
|
|
|
class BlockTestCase < ActiveSupport::TestCase
|
|
|
|
def render_content(start, inside)
|
|
|
|
template = block_helper(start, inside)
|
2017-01-20 18:02:34 -05:00
|
|
|
ActionView::Template::Handlers::ERB.erb_implementation.new(template).evaluate(ViewContext.new)
|
2010-03-17 19:28:05 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def block_helper(str, rest)
|
|
|
|
"<%= #{str} do %>#{rest}<% end %>"
|
|
|
|
end
|
|
|
|
end
|
2012-06-21 12:39:35 -04:00
|
|
|
end
|