From 54573816ab79fac6716d1a1eae8c0da602765774 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 9 Sep 2021 09:11:16 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../projects/pipelines_controller_spec.rb | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'spec/controllers/projects') diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index 774971e992d..1354e894872 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -1292,6 +1292,38 @@ RSpec.describe Projects::PipelinesController do end end + context 'when project uses external project ci config' do + let(:other_project) { create(:project) } + let(:sha) { 'master' } + let(:service) { ::Ci::ListConfigVariablesService.new(other_project, user) } + + let(:ci_config) do + { + variables: { + KEY1: { value: 'val 1', description: 'description 1' } + }, + test: { + stage: 'test', + script: 'echo' + } + } + end + + before do + project.update!(ci_config_path: ".gitlab-ci.yml@#{other_project.full_path}") + synchronous_reactive_cache(service) + end + + it 'returns other project config variables' do + expect(::Ci::ListConfigVariablesService).to receive(:new).with(other_project, anything).and_return(service) + + get_config_variables + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response['KEY1']).to eq({ 'value' => 'val 1', 'description' => 'description 1' }) + end + end + private def stub_gitlab_ci_yml_for_sha(sha, result) -- cgit v1.2.3