This commit is contained in:
Christian Mehlmauer
2013-06-22 21:16:00 +02:00
parent 18ed982aea
commit 698f998307
2 changed files with 18 additions and 1 deletions

View File

@@ -118,8 +118,10 @@ def get_equal_string_end(stringarray = [''])
already_found = ''
looping = true
counter = -1
# remove nils (# Issue #231)
stringarray = stringarray.compact
if stringarray.kind_of? Array and stringarray.length > 1
base = stringarray[0]
base = stringarray.first
while looping
character = base[counter, 1]
stringarray.each do |s|

View File

@@ -20,6 +20,21 @@ describe 'common_helper' do
@expected = ''
end
it 'returns an empty string' do
@input = ['asdf', nil]
@expected = ''
end
it 'returns an empty string' do
@input = [nil, 'asdf']
@expected = ''
end
it 'returns asdf' do
@input = [nil, 'a asdf', nil, 'b asdf']
@expected = ' asdf'
end
it 'returns asdf' do
@input = ['kjh asdf', 'oijr asdf']
@expected = ' asdf'