diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 02:58:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-30 02:58:45 +0300 |
commit | 1794d7d6a11019da7fe8bb56536f3fce69d1825d (patch) | |
tree | 4975bcf5629d6322feab02d1987676ef5fd5411d /spec/controllers/projects/blob_controller_spec.rb | |
parent | 5825f3338e723e631964bf67d259e3365014a442 (diff) |
Add latest changes from gitlab-org/security/gitlab@15-9-stable-ee
Diffstat (limited to 'spec/controllers/projects/blob_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/blob_controller_spec.rb | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index ec92d92e2a9..887a5ba598f 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -2,16 +2,15 @@ require 'spec_helper' -RSpec.describe Projects::BlobController, feature_category: :source_code_management do +RSpec.describe Projects::BlobController do include ProjectForksHelper let(:project) { create(:project, :public, :repository, previous_default_branch: previous_default_branch) } let(:previous_default_branch) { nil } describe "GET show" do - let(:params) { { namespace_id: project.namespace, project_id: project, id: id } } - let(:request) do - get(:show, params: params) + def request + get(:show, params: { namespace_id: project.namespace, project_id: project, id: id }) end render_views @@ -19,32 +18,8 @@ RSpec.describe Projects::BlobController, feature_category: :source_code_manageme context 'with file path' do before do expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original - project.repository.add_tag(project.creator, 'ambiguous_ref', RepoHelpers.sample_commit.id) - project.repository.add_branch(project.creator, 'ambiguous_ref', RepoHelpers.another_sample_commit.id) - request - end - - context 'when the ref is ambiguous' do - let(:ref) { 'ambiguous_ref' } - let(:path) { 'README.md' } - let(:id) { "#{ref}/#{path}" } - let(:params) { { namespace_id: project.namespace, project_id: project, id: id, ref_type: ref_type } } - context 'and explicitly requesting a branch' do - let(:ref_type) { 'heads' } - - it 'redirects to blob#show with sha for the branch' do - expect(response).to redirect_to(project_blob_path(project, "#{RepoHelpers.another_sample_commit.id}/#{path}")) - end - end - - context 'and explicitly requesting a tag' do - let(:ref_type) { 'tags' } - - it 'responds with success' do - expect(response).to be_ok - end - end + request end context "valid branch, valid file" do |