Skip to content

Commit

Permalink
concat should ignore nil
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Jun 7, 2008
1 parent e732a40 commit 26ec1be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/text_helper.rb
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions actionpack/test/template/text_helper_test.rb
Expand Up @@ -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)

Expand Down

0 comments on commit 26ec1be

Please sign in to comment.