diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-06 18:00:01 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-06 18:00:01 -0700 |
commit | 26ec1be24a820327d00e22fb65764a3dc06977e2 (patch) | |
tree | ef57f2e85a8c22ae6a6ea2dffa98c03723845742 /actionpack | |
parent | e732a405ab7d0d04f8a254764970c9dcda988f01 (diff) | |
download | rails-26ec1be24a820327d00e22fb65764a3dc06977e2.tar.gz rails-26ec1be24a820327d00e22fb65764a3dc06977e2.tar.bz2 rails-26ec1be24a820327d00e22fb65764a3dc06977e2.zip |
concat should ignore nil
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/text_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/text_helper_test.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index 3be4843386..f81f7eded6 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -26,7 +26,7 @@ module ActionView # # will either display "Logged in!" or a login link # %> def concat(string) - if @output_buffer + if @output_buffer && string @output_buffer << string else string diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 62cdca03d1..0f5c62acad 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -11,6 +11,14 @@ class TextHelperTest < ActionView::TestCase @_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) |