From 5b4b2ed55320932ddaecbb7ce7f957235a1c73cf Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 26 Jul 2023 01:34:24 +0000 Subject: Add latest changes from gitlab-org/gitlab@16-2-stable-ee --- app/controllers/projects/issues_controller.rb | 1 + spec/features/incidents/incident_details_spec.rb | 30 +++++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 6a45595580f..05be34d63e0 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -334,6 +334,7 @@ class Projects::IssuesController < Projects::ApplicationController end def issue_params + params[:issue][:issue_type] ||= params[:issue_type] if params[:issue_type].present? all_params = params.require(:issue).permit( *issue_params_attributes, sentry_issue_attributes: [:sentry_issue_identifier] diff --git a/spec/features/incidents/incident_details_spec.rb b/spec/features/incidents/incident_details_spec.rb index a166ff46177..2be0c95addd 100644 --- a/spec/features/incidents/incident_details_spec.rb +++ b/spec/features/incidents/incident_details_spec.rb @@ -7,13 +7,20 @@ RSpec.describe 'Incident details', :js, feature_category: :incident_management d let_it_be(:project) { create(:project) } let_it_be(:developer) { create(:user) } - let_it_be(:incident) { create(:incident, project: project, author: developer, description: 'description') } - let_it_be(:issue) { create(:issue, project: project, author: developer, description: 'Issue description') } - let_it_be(:escalation_status) { create(:incident_management_issuable_escalation_status, issue: incident) } let_it_be(:confidential_incident) do create(:incident, confidential: true, project: project, author: developer, description: 'Confidential') end + let_it_be_with_reload(:incident) do + create(:incident, project: project, author: developer, description: 'description') + end + + let_it_be(:escalation_status) { create(:incident_management_issuable_escalation_status, issue: incident) } + + let_it_be_with_reload(:issue) do + create(:issue, project: project, author: developer, description: 'Issue description') + end + before_all do project.add_developer(developer) end @@ -105,12 +112,15 @@ RSpec.describe 'Incident details', :js, feature_category: :incident_management d page.within('[data-testid="issuable-form"]') do click_button 'Issue' find('[data-testid="issue-type-list-item"]', text: 'Incident').click + click_button 'Save changes' + end - wait_for_requests + wait_for_requests - expect(page).to have_current_path("#{project_path}/-/issues/incident/#{issue.iid}") - end + expect(issue.reload.issue_type).to eq('incident') + expect(page).to have_current_path("#{project_path}/-/issues/incident/#{issue.iid}") + expect(page).to have_content(issue.title) end it 'routes the user to the issue details page when the `issue_type` is set to issue' do @@ -126,11 +136,13 @@ RSpec.describe 'Incident details', :js, feature_category: :incident_management d click_button 'Incident' find('[data-testid="issue-type-list-item"]', text: 'Issue').click click_button 'Save changes' + end - wait_for_requests + wait_for_requests - expect(page).to have_current_path("#{project_path}/-/issues/#{incident.iid}") - end + expect(incident.reload.issue_type).to eq('issue') + expect(page).to have_current_path("#{project_path}/-/issues/#{incident.iid}") + expect(page).to have_content(incident.title) end it 'displays the confidential badge on the sticky header when the incident is confidential' do -- cgit v1.2.3