summaryrefslogtreecommitdiff
path: root/spec/requests/api/projects_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-23 21:06:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-23 21:06:17 +0000
commit11faf8ae72dcdbaff31f97410a3a9319324438fd (patch)
tree2dc680f52ef8b2355c9097dfd1bbeb5ba899df3c /spec/requests/api/projects_spec.rb
parent7f0a4a64d0bc59b184ae3ee578adb6ebd3c48bf7 (diff)
downloadgitlab-ce-11faf8ae72dcdbaff31f97410a3a9319324438fd.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/projects_spec.rb')
-rw-r--r--spec/requests/api/projects_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index a4ef050a698..0e343210f5e 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -606,6 +606,7 @@ describe API::Projects do
merge_requests_enabled: false,
wiki_enabled: false,
resolve_outdated_diff_discussions: false,
+ remove_source_branch_after_merge: true,
only_allow_merge_if_pipeline_succeeds: false,
request_access_enabled: true,
only_allow_merge_if_all_discussions_are_resolved: false,
@@ -722,6 +723,22 @@ describe API::Projects do
expect(json_response['resolve_outdated_diff_discussions']).to be_truthy
end
+ it 'sets a project as not removing source branches' do
+ project = attributes_for(:project, remove_source_branch_after_merge: false)
+
+ post api('/projects', user), params: project
+
+ expect(json_response['remove_source_branch_after_merge']).to be_falsey
+ end
+
+ it 'sets a project as removing source branches' do
+ project = attributes_for(:project, remove_source_branch_after_merge: true)
+
+ post api('/projects', user), params: project
+
+ expect(json_response['remove_source_branch_after_merge']).to be_truthy
+ end
+
it 'sets a project as allowing merge even if build fails' do
project = attributes_for(:project, only_allow_merge_if_pipeline_succeeds: false)
@@ -980,6 +997,22 @@ describe API::Projects do
expect(json_response['resolve_outdated_diff_discussions']).to be_truthy
end
+ it 'sets a project as not removing source branches' do
+ project = attributes_for(:project, remove_source_branch_after_merge: false)
+
+ post api("/projects/user/#{user.id}", admin), params: project
+
+ expect(json_response['remove_source_branch_after_merge']).to be_falsey
+ end
+
+ it 'sets a project as removing source branches' do
+ project = attributes_for(:project, remove_source_branch_after_merge: true)
+
+ post api("/projects/user/#{user.id}", admin), params: project
+
+ expect(json_response['remove_source_branch_after_merge']).to be_truthy
+ end
+
it 'sets a project as allowing merge even if build fails' do
project = attributes_for(:project, only_allow_merge_if_pipeline_succeeds: false)
post api("/projects/user/#{user.id}", admin), params: project
@@ -1157,6 +1190,7 @@ describe API::Projects do
expect(json_response['wiki_access_level']).to be_present
expect(json_response['builds_access_level']).to be_present
expect(json_response['resolve_outdated_diff_discussions']).to eq(project.resolve_outdated_diff_discussions)
+ expect(json_response['remove_source_branch_after_merge']).to be_truthy
expect(json_response['container_registry_enabled']).to be_present
expect(json_response['created_at']).to be_present
expect(json_response['last_activity_at']).to be_present