Commit 3879534f authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Fix NoMethodError for RefsController

Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/351520

Fix a typo and add a test

Changelog: fixed
parent ece5fea4
......@@ -62,6 +62,6 @@ class Projects::RefsController < Projects::ApplicationController
private
def validate_ref_id
return not_found! if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex
return not_found if params[:id].present? && params[:id] !~ Gitlab::PathRegex.git_reference_regex
end
end
......@@ -47,6 +47,14 @@ RSpec.describe Projects::RefsController do
expect(response).to be_not_found
end
context 'when ref is incorrect' do
it 'returns 404 page' do
xhr_get(:json, id: '.')
expect(response).to be_not_found
end
end
context 'when json is requested' do
it 'renders JSON' do
expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original
......
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