Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-08-18 13:50:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-08-18 13:50:51 +0300
commitdb384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch)
tree34beaef37df5f47ccbcf5729d7583aae093cffa0 /spec/requests/api/repositories_spec.rb
parent54fd7b1bad233e3944434da91d257fa7f63c3996 (diff)
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'spec/requests/api/repositories_spec.rb')
-rw-r--r--spec/requests/api/repositories_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb
index 8853eff0b3e..a94ed63bf47 100644
--- a/spec/requests/api/repositories_spec.rb
+++ b/spec/requests/api/repositories_spec.rb
@@ -37,6 +37,52 @@ RSpec.describe API::Repositories, feature_category: :source_code_management do
end
end
+ context 'when path does not exist' do
+ let(:path) { 'bogus' }
+
+ context 'when handle_structured_gitaly_errors feature is disabled' do
+ before do
+ stub_feature_flags(handle_structured_gitaly_errors: false)
+ end
+
+ it 'returns an empty array' do
+ get api("#{route}?path=#{path}", current_user)
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response).to include_pagination_headers
+ expect(json_response).to be_an(Array)
+ expect(json_response).to be_an_empty
+ end
+ end
+
+ context 'when handle_structured_gitaly_errors feature is enabled' do
+ before do
+ stub_feature_flags(handle_structured_gitaly_errors: true)
+ end
+
+ it_behaves_like '404 response' do
+ let(:request) { get api("#{route}?path=#{path}", current_user) }
+ let(:message) { '404 invalid revision or path Not Found' }
+ end
+ end
+ end
+
+ context 'when path is empty directory ' do
+ context 'when handle_structured_gitaly_errors feature is disabled' do
+ before do
+ stub_feature_flags(handle_structured_gitaly_errors: false)
+ end
+
+ it 'returns an empty array' do
+ get api(route, current_user)
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(response).to include_pagination_headers
+ expect(json_response).to be_an(Array)
+ end
+ end
+ end
+
context 'when repository is disabled' do
include_context 'disabled repository'