summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorAthar Hameed <athar@gitlab.com>2017-07-28 15:23:40 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-07-28 15:23:40 +0000
commit9442c33584d9667551447aa2d579aec03fb18d50 (patch)
treead333a1b917f2999efc98476d67d055d3373d83c /spec/views
parent883be9c67bdb78bfb695e23cf0b76102d0a358fc (diff)
downloadgitlab-ce-9442c33584d9667551447aa2d579aec03fb18d50.tar.gz
Fix 500 error when rendering avatar for deleted project creator
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/shared/projects/_project.html.haml_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/views/shared/projects/_project.html.haml_spec.rb b/spec/views/shared/projects/_project.html.haml_spec.rb
new file mode 100644
index 00000000000..43334c2c236
--- /dev/null
+++ b/spec/views/shared/projects/_project.html.haml_spec.rb
@@ -0,0 +1,19 @@
+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