Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /spec/lib/gitlab/ci/status/bridge
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'spec/lib/gitlab/ci/status/bridge')
-rw-r--r--spec/lib/gitlab/ci/status/bridge/common_spec.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/status/bridge/common_spec.rb b/spec/lib/gitlab/ci/status/bridge/common_spec.rb
new file mode 100644
index 00000000000..92600b21afc
--- /dev/null
+++ b/spec/lib/gitlab/ci/status/bridge/common_spec.rb
@@ -0,0 +1,49 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Ci::Status::Bridge::Common do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:bridge) { create(:ci_bridge) }
+ let_it_be(:downstream_pipeline) { create(:ci_pipeline) }
+
+ before_all do
+ create(:ci_sources_pipeline,
+ source_pipeline: bridge.pipeline,
+ source_project: bridge.pipeline.project,
+ source_job: bridge,
+ pipeline: downstream_pipeline,
+ project: downstream_pipeline.project)
+ end
+
+ subject do
+ Gitlab::Ci::Status::Core
+ .new(bridge, user)
+ .extend(described_class)
+ end
+
+ describe '#details_path' do
+ context 'when user has access to read downstream pipeline' do
+ before do
+ downstream_pipeline.project.add_developer(user)
+ end
+
+ it { expect(subject).to have_details }
+ it { expect(subject.details_path).to include "pipelines/#{downstream_pipeline.id}" }
+
+ context 'when ci_bridge_pipeline_details is disabled' do
+ before do
+ stub_feature_flags(ci_bridge_pipeline_details: false)
+ end
+
+ it { expect(subject).not_to have_details }
+ it { expect(subject.details_path).to be_nil }
+ end
+ end
+
+ context 'when user does not have access to read downstream pipeline' do
+ it { expect(subject).not_to have_details }
+ it { expect(subject.details_path).to be_nil }
+ end
+ end
+end