diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 21:07:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 21:07:55 +0300 |
commit | 603c7d4cac5e28bc1c75e50c23ed2cbe56f1aafc (patch) | |
tree | 907f5b8ee1b6f5aad396e95e3327a08400b9e8ea /spec/controllers/projects/blob_controller_spec.rb | |
parent | 120f4aaedc8fe830a3f572491d240d8ee6addefb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects/blob_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/blob_controller_spec.rb | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index 225538dcc45..9fdaa728fd7 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -8,18 +8,17 @@ describe Projects::BlobController do let(:project) { create(:project, :public, :repository) } describe "GET show" do + def request + get(:show, params: { namespace_id: project.namespace, project_id: project, id: id }) + end + render_views context 'with file path' do before do expect(::Gitlab::GitalyClient).to receive(:allow_ref_name_caching).and_call_original - get(:show, - params: { - namespace_id: project.namespace, - project_id: project, - id: id - }) + request end context "valid branch, valid file" do @@ -119,6 +118,32 @@ describe Projects::BlobController do end end end + + context 'when there is an artifact with code navigation data' do + let!(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.id) } + let!(:job) { create(:ci_build, pipeline: pipeline, name: Ci::Build::CODE_NAVIGATION_JOB_NAME) } + let!(:artifact) { create(:ci_job_artifact, :lsif, job: job) } + + let(:id) { 'master/README.md' } + + it 'assigns code_navigation_build variable' do + request + + expect(assigns[:code_navigation_build]).to eq(job) + end + + context 'when code_navigation feature is disabled' do + before do + stub_feature_flags(code_navigation: false) + end + + it 'does not assign code_navigation_build variable' do + request + + expect(assigns[:code_navigation_build]).to be_nil + end + end + end end describe 'GET diff' do |