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