2022-03-23 11:08:38 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe Projects::PipelineHelper do
|
2022-06-06 02:09:07 -04:00
|
|
|
include Ci::BuildsHelper
|
|
|
|
|
2022-03-23 11:08:38 -04:00
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:project) { create(:project, :repository) }
|
|
|
|
let_it_be(:raw_pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) }
|
2022-08-26 14:12:09 -04:00
|
|
|
let_it_be(:pipeline) { Ci::PipelinePresenter.new(raw_pipeline, current_user: user) }
|
2022-03-23 11:08:38 -04:00
|
|
|
|
|
|
|
describe '#js_pipeline_tabs_data' do
|
2022-07-08 05:09:44 -04:00
|
|
|
before do
|
|
|
|
project.add_developer(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
subject(:pipeline_tabs_data) { helper.js_pipeline_tabs_data(project, pipeline, user) }
|
2022-03-23 11:08:38 -04:00
|
|
|
|
|
|
|
it 'returns pipeline tabs data' do
|
|
|
|
expect(pipeline_tabs_data).to include({
|
|
|
|
can_generate_codequality_reports: pipeline.can_generate_codequality_reports?.to_json,
|
2022-06-06 02:09:07 -04:00
|
|
|
failed_jobs_count: pipeline.failed_builds.count,
|
|
|
|
failed_jobs_summary: prepare_failed_jobs_summary_data(pipeline.failed_builds),
|
2022-05-20 08:08:50 -04:00
|
|
|
full_path: project.full_path,
|
2022-03-23 11:08:38 -04:00
|
|
|
graphql_resource_etag: graphql_etag_pipeline_path(pipeline),
|
|
|
|
metrics_path: namespace_project_ci_prometheus_metrics_histograms_path(namespace_id: project.namespace, project_id: project, format: :json),
|
2022-05-13 08:08:49 -04:00
|
|
|
pipeline_iid: pipeline.iid,
|
2022-05-20 08:08:50 -04:00
|
|
|
pipeline_project_path: project.full_path,
|
2022-07-28 14:09:03 -04:00
|
|
|
total_job_count: pipeline.total_size,
|
|
|
|
summary_endpoint: summary_project_pipeline_tests_path(project, pipeline, format: :json),
|
|
|
|
suite_endpoint: project_pipeline_test_path(project, pipeline, suite_name: 'suite', format: :json),
|
|
|
|
blob_path: project_blob_path(project, pipeline.sha),
|
2022-08-23 17:10:34 -04:00
|
|
|
has_test_report: pipeline.has_reports?(Ci::JobArtifact.of_report_type(:test)),
|
2022-07-28 14:09:03 -04:00
|
|
|
empty_state_image_path: match_asset_path('illustrations/empty-state/empty-test-cases-lg.svg'),
|
|
|
|
artifacts_expired_image_path: match_asset_path('illustrations/pipeline.svg')
|
2022-03-23 11:08:38 -04:00
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|