diff options
author | Fabio Pitino <fpitino@gitlab.com> | 2019-06-07 14:51:42 +0300 |
---|---|---|
committer | Fabio Pitino <fpitino@gitlab.com> | 2019-06-12 11:51:45 +0300 |
commit | 3ac527b4889b9465b2d55ca0c9317a3e8479a625 (patch) | |
tree | 2cf311b5a19d9c1d4a2f25922fa55ec2a29351ab /spec | |
parent | 641d332351907b77b53b0cb23ff51ccea2489824 (diff) |
Expose ci_default_git_depth via project API
Enable Get and Update of ci_default_git_depth for
Project API.
Renaming Project#default_git_depth to :ci_default_git_depth
to give more context through the API usage.
Add API documentation
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/projects/settings/ci_cd_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/presenters/ci/build_runner_presenter_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/runner_spec.rb | 6 | ||||
-rw-r--r-- | spec/services/projects/fork_service_spec.rb | 8 |
5 files changed, 11 insertions, 9 deletions
diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb index 117b9cf7915..5bfbcf6eeb5 100644 --- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb +++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb @@ -212,7 +212,7 @@ describe Projects::Settings::CiCdController do subject project.reload - expect(project.default_git_depth).to eq(10) + expect(project.ci_default_git_depth).to eq(10) end end end diff --git a/spec/presenters/ci/build_runner_presenter_spec.rb b/spec/presenters/ci/build_runner_presenter_spec.rb index 620f34bac79..a4234d14255 100644 --- a/spec/presenters/ci/build_runner_presenter_spec.rb +++ b/spec/presenters/ci/build_runner_presenter_spec.rb @@ -134,7 +134,7 @@ describe Ci::BuildRunnerPresenter do end it 'defaults to git depth setting for the project' do - expect(git_depth).to eq(build.project.default_git_depth) + expect(git_depth).to eq(build.project.ci_default_git_depth) end context 'when feature flag :ci_project_git_depth is disabled' do diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 799e84e83c1..5f7d2fa6d9c 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -1125,6 +1125,7 @@ describe API::Projects do expect(json_response['shared_with_groups'][0]['expires_at']).to be_nil expect(json_response['only_allow_merge_if_pipeline_succeeds']).to eq(project.only_allow_merge_if_pipeline_succeeds) expect(json_response['only_allow_merge_if_all_discussions_are_resolved']).to eq(project.only_allow_merge_if_all_discussions_are_resolved) + expect(json_response['ci_default_git_depth']).to eq(project.ci_default_git_depth) expect(json_response['merge_method']).to eq(project.merge_method.to_s) expect(json_response['readme_url']).to eq(project.readme_url) end @@ -1963,6 +1964,7 @@ describe API::Projects do snippets_enabled: true, merge_requests_enabled: true, merge_method: 'ff', + ci_default_git_depth: 20, description: 'new description' } put api("/projects/#{project3.id}", user4), params: project_param diff --git a/spec/requests/api/runner_spec.rb b/spec/requests/api/runner_spec.rb index 038c958b5cc..d9ef5edb848 100644 --- a/spec/requests/api/runner_spec.rb +++ b/spec/requests/api/runner_spec.rb @@ -445,7 +445,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do 'before_sha' => job.before_sha, 'ref_type' => 'branch', 'refspecs' => ["+refs/heads/#{job.ref}:refs/remotes/origin/#{job.ref}"], - 'depth' => project.default_git_depth } + 'depth' => project.ci_default_git_depth } end let(:expected_steps) do @@ -533,7 +533,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do context 'when GIT_DEPTH is not specified and there is no default git depth for the project' do before do - project.update!(default_git_depth: nil) + project.update!(ci_default_git_depth: nil) end it 'specifies refspecs' do @@ -593,7 +593,7 @@ describe API::Runner, :clean_gitlab_redis_shared_state do context 'when GIT_DEPTH is not specified and there is no default git depth for the project' do before do - project.update!(default_git_depth: nil) + project.update!(ci_default_git_depth: nil) end it 'specifies refspecs' do diff --git a/spec/services/projects/fork_service_spec.rb b/spec/services/projects/fork_service_spec.rb index 3211a6e1310..6afc91d5e95 100644 --- a/spec/services/projects/fork_service_spec.rb +++ b/spec/services/projects/fork_service_spec.rb @@ -150,21 +150,21 @@ describe Projects::ForkService do context "when origin has git depth specified" do before do - @from_project.update(default_git_depth: 42) + @from_project.update(ci_default_git_depth: 42) end it "inherits default_git_depth from the origin project" do - expect(to_project.default_git_depth).to eq(42) + expect(to_project.ci_default_git_depth).to eq(42) end end context "when origin does not define git depth" do before do - @from_project.update!(default_git_depth: nil) + @from_project.update!(ci_default_git_depth: nil) end it "the fork has git depth set to 0" do - expect(to_project.default_git_depth).to eq(0) + expect(to_project.ci_default_git_depth).to eq(0) end end end |