Restore implicit to_s for content_for and provide
This commit is contained in:
parent
226f22e843
commit
f55f923a5f
@ -17,12 +17,12 @@ def get(key)
|
||||
|
||||
# Called by each renderer object to set the layout contents.
|
||||
def set(key, value)
|
||||
@content[key] = ActiveSupport::SafeBuffer.new(value)
|
||||
@content[key] = ActiveSupport::SafeBuffer.new(value.to_s)
|
||||
end
|
||||
|
||||
# Called by content_for
|
||||
def append(key, value)
|
||||
@content[key] << value
|
||||
@content[key] << value.to_s
|
||||
end
|
||||
alias_method :append!, :append
|
||||
end
|
||||
|
@ -51,14 +51,14 @@ def test_content_for_used_for_read
|
||||
def test_content_for_with_multiple_calls
|
||||
assert_not content_for?(:title)
|
||||
content_for :title, "foo"
|
||||
content_for :title, "bar"
|
||||
content_for :title, :bar
|
||||
assert_equal "foobar", content_for(:title)
|
||||
end
|
||||
|
||||
def test_content_for_with_multiple_calls_and_flush
|
||||
assert_not content_for?(:title)
|
||||
content_for :title, "foo"
|
||||
content_for :title, "bar", flush: true
|
||||
content_for :title, :bar, flush: true
|
||||
assert_equal "bar", content_for(:title)
|
||||
end
|
||||
|
||||
@ -172,7 +172,7 @@ def test_provide
|
||||
assert_equal "hi<p>title</p>", content_for(:title)
|
||||
|
||||
@view_flow = ActionView::OutputFlow.new
|
||||
provide :title, "hi"
|
||||
provide :title, :hi
|
||||
provide :title, raw("<p>title</p>")
|
||||
assert_equal "hi<p>title</p>", content_for(:title)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user