Browse files

concat should ignore nil

  • Loading branch information...
1 parent e732a40 commit 26ec1be24a820327d00e22fb65764a3dc06977e2 @jeremy jeremy committed Jun 7, 2008
View
2 actionpack/lib/action_view/helpers/text_helper.rb
@@ -26,7 +26,7 @@ module TextHelper
# # will either display "Logged in!" or a login link
# %>
def concat(string)
- if @output_buffer
+ if @output_buffer && string
@output_buffer << string
else
string
View
8 actionpack/test/template/text_helper_test.rb
@@ -11,6 +11,14 @@ def setup
@_cycles = nil if (defined? @_cycles)
end
+ def test_concat
+ @output_buffer = 'foo'
+ concat 'bar'
+ assert_equal 'foobar', @output_buffer
+ assert_nothing_raised { concat nil }
+ assert_equal 'foobar', @output_buffer
+ end
+
def test_simple_format
assert_equal "<p></p>", simple_format(nil)

0 comments on commit 26ec1be

Please sign in to comment.