Commit 979f57bb authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '9928-bugfix-drop-rule-default' into 'master'

Drop default rule_type when creating project approval rules

See merge request gitlab-org/gitlab-ee!14790
parents efe4ff67 9bd447fb
......@@ -29,7 +29,7 @@ module API
params do
requires :name, type: String, desc: 'The name of the approval rule'
requires :approvals_required, type: Integer, desc: 'The number of required approvals for this rule'
optional :rule_type, type: String, desc: 'The type of approval rule', default: 'regular'
optional :rule_type, type: String, desc: 'The type of approval rule'
optional :users, as: :user_ids, type: Array, coerce_with: ARRAY_COERCION_LAMBDA, desc: 'The user ids for this rule'
optional :groups, as: :group_ids, type: Array, coerce_with: ARRAY_COERCION_LAMBDA, desc: 'The group ids for this rule'
end
......
......@@ -133,6 +133,14 @@ describe API::ProjectApprovalRules do
expect(json_response.symbolize_keys).to include(params)
end
it 'sets rule_type as report_approver if name matches default name for security reports' do
expect do
post api(url, current_user), params: params.merge(name: ApprovalProjectRule::DEFAULT_NAME_FOR_SECURITY_REPORT)
end.to change { ApprovalProjectRule.report_approver.count }.from(0).to(1)
expect(response).to have_gitlab_http_status(201)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment