summaryrefslogtreecommitdiff
path: root/spec/helpers/ci/jobs_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/ci/jobs_helper_spec.rb')
-rw-r--r--spec/helpers/ci/jobs_helper_spec.rb53
1 files changed, 39 insertions, 14 deletions
diff --git a/spec/helpers/ci/jobs_helper_spec.rb b/spec/helpers/ci/jobs_helper_spec.rb
index 489d9d3fcee..a9ab4ab3b67 100644
--- a/spec/helpers/ci/jobs_helper_spec.rb
+++ b/spec/helpers/ci/jobs_helper_spec.rb
@@ -3,24 +3,49 @@
require 'spec_helper'
RSpec.describe Ci::JobsHelper do
- describe 'jobs data' do
- let(:project) { create(:project, :repository) }
- let(:bridge) { create(:ci_bridge) }
-
- subject(:bridge_data) { helper.bridge_data(bridge, project) }
+ describe 'job helper functions' do
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:job) { create(:ci_build, project: project) }
before do
- allow(helper)
- .to receive(:image_path)
- .and_return('/path/to/illustration')
+ helper.instance_variable_set(:@project, project)
+ helper.instance_variable_set(:@build, job)
+ end
+
+ it 'returns jobs data' do
+ expect(helper.jobs_data).to include({
+ "endpoint" => "/#{project.full_path}/-/jobs/#{job.id}.json",
+ "project_path" => project.full_path,
+ "artifact_help_url" => "/help/user/gitlab_com/index.md#gitlab-cicd",
+ "deployment_help_url" => "/help/user/project/clusters/deploy_to_cluster.md#troubleshooting",
+ "runner_settings_url" => "/#{project.full_path}/-/runners#js-runners-settings",
+ "page_path" => "/#{project.full_path}/-/jobs/#{job.id}",
+ "build_status" => "pending",
+ "build_stage" => "test",
+ "log_state" => "",
+ "build_options" => {
+ build_stage: "test",
+ build_status: "pending",
+ log_state: "",
+ page_path: "/#{project.full_path}/-/jobs/#{job.id}"
+ },
+ "retry_outdated_job_docs_url" => "/help/ci/pipelines/settings#retry-outdated-jobs"
+ })
end
- it 'returns bridge data' do
- expect(bridge_data).to eq({
- "build_id" => bridge.id,
- "empty-state-illustration-path" => '/path/to/illustration',
- "pipeline_iid" => bridge.pipeline.iid,
- "project_full_path" => project.full_path
+ it 'returns job statuses' do
+ expect(helper.job_statuses).to eq({
+ "canceled" => "CANCELED",
+ "created" => "CREATED",
+ "failed" => "FAILED",
+ "manual" => "MANUAL",
+ "pending" => "PENDING",
+ "preparing" => "PREPARING",
+ "running" => "RUNNING",
+ "scheduled" => "SCHEDULED",
+ "skipped" => "SKIPPED",
+ "success" => "SUCCESS",
+ "waiting_for_resource" => "WAITING_FOR_RESOURCE"
})
end
end