Commit 9442c335 authored by Athar Hameed's avatar Athar Hameed Committed by Sean McGivern

Fix 500 error when rendering avatar for deleted project creator

parent 883be9c6
......@@ -14,7 +14,7 @@
- if avatar
.avatar-container.s40
= link_to project_path(project), class: dom_class(project) do
- if use_creator_avatar
- if project.creator && use_creator_avatar
= image_tag avatar_icon(project.creator.email, 40), class: "avatar s40", alt:''
- else
= project_icon(project, alt: '', class: 'avatar project-avatar s40')
......
---
title: Modify if condition to be more readable
merge_request:
author:
require 'spec_helper'
describe 'shared/projects/_project.html.haml' do
let(:project) { create(:empty_project) }
it 'should render creator avatar if project has a creator' do
render 'shared/projects/project', use_creator_avatar: true, project: project
expect(rendered).to have_selector('img.avatar')
end
it 'should render a generic avatar if project does not have a creator' do
project.creator = nil
render 'shared/projects/project', use_creator_avatar: true, project: project
expect(rendered).to have_selector('.project-avatar')
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment