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>2022-11-01 14:52:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-01 14:52:43 +0300
commit430576c997e7cfc61b003cf6dbf12817ef899eef (patch)
tree7884f12a7837f5029b971e04121a66fb81ffdb34 /spec/controllers/projects/pipelines_controller_spec.rb
parentafbc608ba558c62cc0475dfb95df3f375049973b (diff)
Add latest changes from gitlab-org/security/gitlab@15-5-stable-ee
Diffstat (limited to 'spec/controllers/projects/pipelines_controller_spec.rb')
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb26
1 files changed, 9 insertions, 17 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb
index 6e2de0c4d57..b132c0b5a69 100644
--- a/spec/controllers/projects/pipelines_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_controller_spec.rb
@@ -1360,11 +1360,12 @@ RSpec.describe Projects::PipelinesController do
describe 'GET config_variables.json', :use_clean_rails_memory_store_caching do
include ReactiveCachingHelpers
- let(:result) { YAML.dump(ci_config) }
- let(:service) { Ci::ListConfigVariablesService.new(project, user) }
+ let(:ci_config) { '' }
+ let(:files) { { '.gitlab-ci.yml' => YAML.dump(ci_config) } }
+ let(:project) { create(:project, :auto_devops_disabled, :custom_repo, files: files) }
+ let(:service) { Ci::ListConfigVariablesService.new(project, user) }
before do
- stub_gitlab_ci_yml_for_sha(sha, result)
allow(Ci::ListConfigVariablesService)
.to receive(:new)
.and_return(service)
@@ -1398,7 +1399,6 @@ RSpec.describe Projects::PipelinesController do
context 'when sending an invalid sha' do
let(:sha) { 'invalid-sha' }
- let(:ci_config) { nil }
before do
synchronous_reactive_cache(service)
@@ -1460,11 +1460,11 @@ RSpec.describe Projects::PipelinesController do
end
context 'when project uses external project ci config' do
- let(:other_project) { create(:project) }
+ let(:other_project) { create(:project, :custom_repo, files: other_project_files) }
+ let(:other_project_files) { { '.gitlab-ci.yml' => YAML.dump(other_project_ci_config) } }
let(:sha) { 'master' }
- let(:service) { ::Ci::ListConfigVariablesService.new(other_project, user) }
- let(:ci_config) do
+ let(:other_project_ci_config) do
{
variables: {
KEY1: { value: 'val 1', description: 'description 1' }
@@ -1477,13 +1477,12 @@ RSpec.describe Projects::PipelinesController do
end
before do
- project.update!(ci_config_path: ".gitlab-ci.yml@#{other_project.full_path}")
+ other_project.add_developer(user)
+ project.update!(ci_config_path: ".gitlab-ci.yml@#{other_project.full_path}:master")
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)
@@ -1493,13 +1492,6 @@ RSpec.describe Projects::PipelinesController do
private
- def stub_gitlab_ci_yml_for_sha(sha, result)
- allow_any_instance_of(Repository)
- .to receive(:gitlab_ci_yml_for)
- .with(sha, '.gitlab-ci.yml')
- .and_return(result)
- end
-
def get_config_variables
get :config_variables, params: { namespace_id: project.namespace,
project_id: project,