fix: Undefined method `length' for nil:NilClass (#8491)

This commit is contained in:
Sivin Varghese
2023-12-05 16:34:29 +05:30
committed by GitHub
parent c1ac354c9b
commit 17faa6c3b2
2 changed files with 3 additions and 1 deletions

View File

@@ -249,7 +249,7 @@ describe PortalHelper do
describe '#thumbnail_bg_color' do
it 'returns the correct color based on username length' do
expect(helper.thumbnail_bg_color('')).to eq('#6D95BA') # Length 0, so index is 0
expect(helper.thumbnail_bg_color('')).to be_in(['#6D95BA', '#A4C3C3', '#E19191'])
expect(helper.thumbnail_bg_color('Joe')).to eq('#6D95BA') # Length 3, so index is 0
expect(helper.thumbnail_bg_color('John')).to eq('#A4C3C3') # Length 4, so index is 1
expect(helper.thumbnail_bg_color('Jane james')).to eq('#A4C3C3') # Length 10, so index is 1