From db384e6b19af03b4c3c82a5760d83a3fd79f7982 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 18 Aug 2023 10:50:51 +0000 Subject: Add latest changes from gitlab-org/gitlab@16-3-stable-ee --- spec/controllers/projects/tree_controller_spec.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'spec/controllers/projects/tree_controller_spec.rb') diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb index ffec670e97d..a409030e359 100644 --- a/spec/controllers/projects/tree_controller_spec.rb +++ b/spec/controllers/projects/tree_controller_spec.rb @@ -90,8 +90,15 @@ RSpec.describe Projects::TreeController, feature_category: :source_code_manageme context 'and explicitly requesting a branch' do let(:ref_type) { 'heads' } + it 'checks for tree with ref_type' do + allow(project.repository).to receive(:tree).and_call_original + expect(project.repository).to receive(:tree).with(id, '', ref_type: 'heads').and_call_original + request + end + it 'finds the branch' do expect(requested_ref_double).not_to receive(:find) + request expect(response).to be_ok end @@ -100,6 +107,12 @@ RSpec.describe Projects::TreeController, feature_category: :source_code_manageme context 'and explicitly requesting a tag' do let(:ref_type) { 'tags' } + it 'checks for tree with ref_type' do + allow(project.repository).to receive(:tree).and_call_original + expect(project.repository).to receive(:tree).with(id, '', ref_type: 'tags').and_call_original + request + end + it 'finds the tag' do expect(requested_ref_double).not_to receive(:find) request @@ -110,7 +123,13 @@ RSpec.describe Projects::TreeController, feature_category: :source_code_manageme end context "valid branch, no path" do - let(:id) { 'master' } + let(:id) { 'flatten-dir' } + + it 'checks for tree without ref_type' do + allow(project.repository).to receive(:tree).and_call_original + expect(project.repository).to receive(:tree).with(RepoHelpers.another_sample_commit.id, '').and_call_original + request + end it 'responds with success' do request -- cgit v1.2.3