diff options
Diffstat (limited to 'spec/lib/gitlab/code_navigation_path_spec.rb')
-rw-r--r-- | spec/lib/gitlab/code_navigation_path_spec.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/lib/gitlab/code_navigation_path_spec.rb b/spec/lib/gitlab/code_navigation_path_spec.rb index 938a2f821fd..07d4dfba622 100644 --- a/spec/lib/gitlab/code_navigation_path_spec.rb +++ b/spec/lib/gitlab/code_navigation_path_spec.rb @@ -12,12 +12,25 @@ describe Gitlab::CodeNavigationPath do let(:commit_sha) { sha } let(:path) { 'lib/app.rb' } + let(:lsif_path) { "/#{project.full_path}/-/jobs/#{job.id}/artifacts/raw/lsif/#{path}.json?file_type=lsif" } subject { described_class.new(project, commit_sha).full_json_path_for(path) } + before do + stub_feature_flags(code_navigation: project) + end + context 'when a pipeline exist for a sha' do it 'returns path to a file in the artifact' do - expect(subject).to eq("/#{project.full_path}/-/jobs/#{job.id}/artifacts/raw/lsif/#{path}.json?file_type=lsif") + expect(subject).to eq(lsif_path) + end + + context 'when passed commit sha is nil' do + let(:commit_sha) { nil } + + it 'returns path to a file in the artifact' do + expect(subject).to eq(lsif_path) + end end end @@ -25,7 +38,7 @@ describe Gitlab::CodeNavigationPath do let(:commit_sha) { project.commit.id } it 'returns path to a file in the artifact' do - expect(subject).to eq("/#{project.full_path}/-/jobs/#{job.id}/artifacts/raw/lsif/#{path}.json?file_type=lsif") + expect(subject).to eq(lsif_path) end end |