diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /spec/controllers/projects/tree_controller_spec.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'spec/controllers/projects/tree_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/tree_controller_spec.rb | 21 |
1 files changed, 20 insertions, 1 deletions
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 |