Commit 0617fb47 authored by Jan Provaznik's avatar Jan Provaznik Committed by Heinrich Lee Yu

Add new issue type for requirements

parent ac7a6af6
......@@ -87,7 +87,8 @@ class Issue < ApplicationRecord
enum issue_type: {
issue: 0,
incident: 1,
test_case: 2 ## EE-only
test_case: 2, ## EE-only
requirement: 3 ## EE-only
}
alias_method :issuing_parent, :project
......
......@@ -13385,6 +13385,7 @@ Issue type.
| ----- | ----------- |
| <a id="issuetypeincident"></a>`INCIDENT` | Incident issue type. |
| <a id="issuetypeissue"></a>`ISSUE` | Issue issue type. |
| <a id="issuetyperequirement"></a>`REQUIREMENT` | Requirement issue type. |
| <a id="issuetypetest_case"></a>`TEST_CASE` | Test Case issue type. |
### `IterationState`
......
......@@ -5,6 +5,8 @@ module EE
module BuildService
extend ::Gitlab::Utils::Override
DISABLED_ISSUE_TYPES = %w[test_case requirement].freeze
def issue_params_from_template
return {} unless project.feature_available?(:issuable_default_templates)
......@@ -22,7 +24,7 @@ module EE
override :allowed_issue_base_params
def allowed_issue_base_params
return super - [:issue_type] if params[:issue_type] == 'test_case'
return super - [:issue_type] if DISABLED_ISSUE_TYPES.include?(params[:issue_type])
super
end
......
......@@ -63,10 +63,12 @@ RSpec.describe Issues::BuildService do
let(:user) { guest }
context 'setting issue type' do
it 'cannot set test_case' do
issue = build_issue(issue_type: 'test_case')
Issues::BuildService::DISABLED_ISSUE_TYPES.each do |type|
it "cannot set #{type}" do
issue = build_issue(issue_type: type)
expect(issue).to be_issue
expect(issue).to be_issue
end
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