Commit cfc199ab authored by charlie ablett's avatar charlie ablett

Test case return 404 instead of 500 error

Changelog: added
EE: true
parent 60cc382d
...@@ -26,7 +26,7 @@ class Projects::Quality::TestCasesController < Projects::ApplicationController ...@@ -26,7 +26,7 @@ class Projects::Quality::TestCasesController < Projects::ApplicationController
.execute .execute
.iid_in(params[:id]) .iid_in(params[:id])
.without_order .without_order
.first .take! # rubocop: disable CodeReuse/ActiveRecord
serializer = IssueSerializer.new(current_user: current_user, project: project) serializer = IssueSerializer.new(current_user: current_user, project: project)
......
...@@ -108,6 +108,16 @@ RSpec.describe Projects::Quality::TestCasesController do ...@@ -108,6 +108,16 @@ RSpec.describe Projects::Quality::TestCasesController do
expect(assigns(:test_case)).to eq(test_case) expect(assigns(:test_case)).to eq(test_case)
expect(assigns(:issuable_sidebar)).to be_present expect(assigns(:issuable_sidebar)).to be_present
end end
context 'when test case is not found' do
let(:test_case) { non_existing_record_id }
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end end
end end
end end
......
...@@ -179,4 +179,18 @@ RSpec.describe 'Test Cases', :js do ...@@ -179,4 +179,18 @@ RSpec.describe 'Test Cases', :js do
end end
end end
end end
describe 'for a nonexistent test case' do
let(:test_case) { non_existing_record_id }
it 'renders 404 page' do
requests = inspect_requests do
visit project_quality_test_case_path(project, test_case)
wait_for_all_requests
end
expect(requests.first.status_code).to eq(404)
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