Standard filter truncate: truncate_string string coercion

The argument `truncate_string` is now coerced into a string to avoid
`NoMethodError`s. This is mostly for added resiliency. It is doubtful
that someone would actually intent to use a number as truncate string,
but accidentally supplying one is entirely possible.
This commit is contained in:
Konstantin Tennhard
2016-09-12 12:13:12 -04:00
parent 302185a7fc
commit 95d5c24bfc
2 changed files with 4 additions and 2 deletions

View File

@@ -115,6 +115,7 @@ class StandardFiltersTest < Minitest::Test
assert_equal '...', @filters.truncate('1234567890', 0)
assert_equal '1234567890', @filters.truncate('1234567890')
assert_equal "测试...", @filters.truncate("测试测试测试测试", 5)
assert_equal '12341', @filters.truncate("1234567890", 5, 1)
end
def test_split