Commit adf82f85 authored by Tetiana Chupryna's avatar Tetiana Chupryna

Add tests for `expose_security_dashboard?`

parent 952e3d0f
......@@ -4,13 +4,11 @@ require 'spec_helper'
describe Ci::PipelinePresenter do
let_it_be(:project, reload: true) { create(:project) }
let_it_be(:pipeline, reload: true) { create(:ci_pipeline, project: project) }
let_it_be(:pipeline, reload: true) { create(:ee_ci_pipeline, project: project) }
subject(:presenter) do
described_class.new(pipeline)
end
let(:presenter) { described_class.new(pipeline) }
describe '.failure_reason' do
describe '#failure_reason' do
context 'when pipeline has failure reason' do
it 'represents a failure reason sentence' do
pipeline.failure_reason = :activity_limit_exceeded
......@@ -26,4 +24,26 @@ describe Ci::PipelinePresenter do
end
end
end
describe '#expose_security_dashboard?' do
subject { pipeline.expose_security_dashboard? }
context 'when there is an artifact of a right type' do
let!(:build) { create(:ee_ci_build, :dependency_scanning, pipeline: pipeline) }
it { is_expected.to be_truthy }
end
context 'when there is an artifact of a wrong type' do
let!(:build) { create(:ee_ci_build, :license_scanning, pipeline: pipeline) }
it { is_expected.to be_falsey }
end
context 'when there is no found artifact' do
let!(:build) { create(:ee_ci_build, pipeline: pipeline) }
it { is_expected.to be_falsey }
end
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