mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
cd2b3be9a6
This allows `render_in` components that compile their own templates to use their view context's current output buffer while a `with_output_buffer` block is being evaluated. Partially addresses #39377.
21 lines
527 B
Ruby
21 lines
527 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "abstract_unit"
|
|
require "action_view/template/handlers/erb/erubi"
|
|
|
|
class ErubiTest < ActiveSupport::TestCase
|
|
test "can configure bufvar" do
|
|
template = <<~ERB
|
|
foo
|
|
|
|
<%= "foo".upcase %>
|
|
|
|
<%== "foo".length %>
|
|
ERB
|
|
|
|
baseline = ActionView::Template::Handlers::ERB::Erubi.new(template)
|
|
erubi = ActionView::Template::Handlers::ERB::Erubi.new(template, bufvar: "boofer")
|
|
|
|
assert_equal baseline.src.gsub("#{baseline.bufvar}.", "boofer."), erubi.src
|
|
end
|
|
end
|