diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/admin/services_controller_spec.rb | 19 | ||||
-rw-r--r-- | spec/controllers/projects/blob_controller_spec.rb | 37 |
2 files changed, 37 insertions, 19 deletions
diff --git a/spec/controllers/admin/services_controller_spec.rb b/spec/controllers/admin/services_controller_spec.rb index 35801643181..5dde0d57293 100644 --- a/spec/controllers/admin/services_controller_spec.rb +++ b/spec/controllers/admin/services_controller_spec.rb @@ -10,21 +10,14 @@ describe Admin::ServicesController do end describe 'GET #edit' do - let!(:project) { create(:project) } - - Service.available_services_names.each do |service_name| - context "#{service_name}" do - let!(:service) do - service_template = "#{service_name}_service".camelize.constantize - service_template.where(template: true).first_or_create - end + let!(:service) do + create(:jira_service, :template) + end - it 'successfully displays the template' do - get :edit, params: { id: service.id } + it 'successfully displays the template' do + get :edit, params: { id: service.id } - expect(response).to have_gitlab_http_status(:ok) - end - end + expect(response).to have_gitlab_http_status(:ok) end end 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 |