diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-08 15:13:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-08 15:13:55 +0300 |
commit | 571b02efc9442e73538c3438eb593a83d7807779 (patch) | |
tree | 96c4ecbdaa066fac502111a3192cc396d6f4a79a /spec/services/issues/build_service_spec.rb | |
parent | efe3186770a4218333e1a720f1e4d3794892673e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/issues/build_service_spec.rb')
-rw-r--r-- | spec/services/issues/build_service_spec.rb | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/spec/services/issues/build_service_spec.rb b/spec/services/issues/build_service_spec.rb index fecfc3f3d64..8368a34caf0 100644 --- a/spec/services/issues/build_service_spec.rb +++ b/spec/services/issues/build_service_spec.rb @@ -175,31 +175,37 @@ RSpec.describe Issues::BuildService, feature_category: :team_planning do describe 'setting issue type' do context 'with a corresponding WorkItems::Type' do + let_it_be(:type_task) { WorkItems::Type.default_by_type(:task) } + let_it_be(:type_task_id) { type_task.id } let_it_be(:type_issue_id) { WorkItems::Type.default_issue_type.id } let_it_be(:type_incident_id) { WorkItems::Type.default_by_type(:incident).id } - - where(:issue_type, :current_user, :work_item_type_id, :resulting_issue_type) do - nil | ref(:guest) | ref(:type_issue_id) | 'issue' - 'issue' | ref(:guest) | ref(:type_issue_id) | 'issue' - 'incident' | ref(:guest) | ref(:type_issue_id) | 'issue' - 'incident' | ref(:reporter) | ref(:type_incident_id) | 'incident' + let(:combined_params) { { work_item_type: type_task, issue_type: 'issue' } } + let(:work_item_params) { { work_item_type_id: type_task_id } } + + where(:issue_params, :current_user, :work_item_type_id, :resulting_issue_type) do + { issue_type: nil } | ref(:guest) | ref(:type_issue_id) | 'issue' + { issue_type: 'issue' } | ref(:guest) | ref(:type_issue_id) | 'issue' + { issue_type: 'incident' } | ref(:guest) | ref(:type_issue_id) | 'issue' + { issue_type: 'incident' } | ref(:reporter) | ref(:type_incident_id) | 'incident' + ref(:combined_params) | ref(:reporter) | ref(:type_task_id) | 'task' + ref(:work_item_params) | ref(:reporter) | ref(:type_task_id) | 'task' # update once support for test_case is enabled - 'test_case' | ref(:guest) | ref(:type_issue_id) | 'issue' + { issue_type: 'test_case' } | ref(:guest) | ref(:type_issue_id) | 'issue' # update once support for requirement is enabled - 'requirement' | ref(:guest) | ref(:type_issue_id) | 'issue' - 'invalid' | ref(:guest) | ref(:type_issue_id) | 'issue' + { issue_type: 'requirement' } | ref(:guest) | ref(:type_issue_id) | 'issue' + { issue_type: 'invalid' } | ref(:guest) | ref(:type_issue_id) | 'issue' # ensure that we don't set a value which has a permission check but is an invalid issue type - 'project' | ref(:guest) | ref(:type_issue_id) | 'issue' + { issue_type: 'project' } | ref(:guest) | ref(:type_issue_id) | 'issue' end with_them do let(:user) { current_user } it 'builds an issue' do - issue = build_issue(issue_type: issue_type) + issue = build_issue(**issue_params) - expect(issue.issue_type).to eq(resulting_issue_type) expect(issue.work_item_type_id).to eq(work_item_type_id) + expect(issue.attributes['issue_type']).to eq(resulting_issue_type) end end end |