2019-10-08 08:06:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-15 04:20:35 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'projects/commits/_commit.html.haml' do
|
2019-11-20 10:06:39 -05:00
|
|
|
let(:template) { 'projects/commits/commit.html.haml' }
|
2019-02-25 06:03:28 -05:00
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
let(:commit) { project.repository.commit(ref) }
|
|
|
|
|
2017-08-31 05:47:03 -04:00
|
|
|
before do
|
|
|
|
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
|
|
|
|
end
|
|
|
|
|
2019-02-25 06:03:28 -05:00
|
|
|
context 'with a signed commit' do
|
2017-08-15 04:20:35 -04:00
|
|
|
let(:ref) { GpgHelpers::SIGNED_COMMIT_SHA }
|
|
|
|
|
|
|
|
it 'does not display a loading spinner for GPG status' do
|
2019-11-20 10:06:39 -05:00
|
|
|
render partial: template, locals: {
|
2017-08-15 04:20:35 -04:00
|
|
|
project: project,
|
|
|
|
ref: ref,
|
|
|
|
commit: commit
|
|
|
|
}
|
|
|
|
|
|
|
|
within '.gpg-status-box' do
|
|
|
|
expect(page).not_to have_css('i.fa.fa-spinner.fa-spin')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-02-25 06:03:28 -05:00
|
|
|
|
|
|
|
context 'with ci status' do
|
|
|
|
let(:ref) { 'master' }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
allow(view).to receive(:current_user).and_return(user)
|
|
|
|
|
|
|
|
project.add_developer(user)
|
|
|
|
|
|
|
|
create(
|
|
|
|
:ci_empty_pipeline,
|
|
|
|
ref: 'master',
|
|
|
|
sha: commit.id,
|
|
|
|
status: 'success',
|
|
|
|
project: project
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipelines are disabled' do
|
|
|
|
before do
|
|
|
|
allow(project).to receive(:builds_enabled?).and_return(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not display a ci status icon' do
|
2019-11-20 10:06:39 -05:00
|
|
|
render partial: template, locals: {
|
2019-02-25 06:03:28 -05:00
|
|
|
project: project,
|
|
|
|
ref: ref,
|
|
|
|
commit: commit
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(rendered).not_to have_css('.ci-status-link')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when pipelines are enabled' do
|
|
|
|
before do
|
|
|
|
allow(project).to receive(:builds_enabled?).and_return(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does display a ci status icon when pipelines are enabled' do
|
2019-11-20 10:06:39 -05:00
|
|
|
render partial: template, locals: {
|
2019-02-25 06:03:28 -05:00
|
|
|
project: project,
|
|
|
|
ref: ref,
|
|
|
|
commit: commit
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(rendered).to have_css('.ci-status-link')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2017-08-15 04:20:35 -04:00
|
|
|
end
|