2019-10-08 12:06:01 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-07-28 15:23:40 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 15:08:50 +00:00
|
|
|
RSpec.describe 'shared/projects/_project.html.haml' do
|
2020-04-21 15:21:10 +00:00
|
|
|
let_it_be(:project) { create(:project) }
|
2017-07-28 15:23:40 +00:00
|
|
|
|
2017-08-31 09:47:03 +00:00
|
|
|
before do
|
|
|
|
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
|
2017-12-11 14:21:06 +00:00
|
|
|
allow(view).to receive(:can?) { true }
|
2017-08-31 09:47:03 +00:00
|
|
|
end
|
|
|
|
|
2019-04-05 08:43:27 +00:00
|
|
|
it 'renders creator avatar if project has a creator' do
|
2017-07-28 15:23:40 +00:00
|
|
|
render 'shared/projects/project', use_creator_avatar: true, project: project
|
|
|
|
|
|
|
|
expect(rendered).to have_selector('img.avatar')
|
|
|
|
end
|
|
|
|
|
2019-04-05 08:43:27 +00:00
|
|
|
it 'renders a generic avatar if project does not have a creator' do
|
2017-07-28 15:23:40 +00:00
|
|
|
project.creator = nil
|
|
|
|
|
|
|
|
render 'shared/projects/project', use_creator_avatar: true, project: project
|
|
|
|
|
|
|
|
expect(rendered).to have_selector('.project-avatar')
|
|
|
|
end
|
|
|
|
end
|