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