Fix Issue #231
This commit is contained in:
@@ -118,8 +118,10 @@ def get_equal_string_end(stringarray = [''])
|
|||||||
already_found = ''
|
already_found = ''
|
||||||
looping = true
|
looping = true
|
||||||
counter = -1
|
counter = -1
|
||||||
|
# remove nils (# Issue #231)
|
||||||
|
stringarray = stringarray.compact
|
||||||
if stringarray.kind_of? Array and stringarray.length > 1
|
if stringarray.kind_of? Array and stringarray.length > 1
|
||||||
base = stringarray[0]
|
base = stringarray.first
|
||||||
while looping
|
while looping
|
||||||
character = base[counter, 1]
|
character = base[counter, 1]
|
||||||
stringarray.each do |s|
|
stringarray.each do |s|
|
||||||
|
|||||||
@@ -20,6 +20,21 @@ describe 'common_helper' do
|
|||||||
@expected = ''
|
@expected = ''
|
||||||
end
|
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
|
it 'returns asdf' do
|
||||||
@input = ['kjh asdf', 'oijr asdf']
|
@input = ['kjh asdf', 'oijr asdf']
|
||||||
@expected = ' asdf'
|
@expected = ' asdf'
|
||||||
|
|||||||
Reference in New Issue
Block a user