Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/types/ci/job_trace_type_spec.rb')
-rw-r--r--spec/graphql/types/ci/job_trace_type_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/graphql/types/ci/job_trace_type_spec.rb b/spec/graphql/types/ci/job_trace_type_spec.rb
new file mode 100644
index 00000000000..71803aa9ece
--- /dev/null
+++ b/spec/graphql/types/ci/job_trace_type_spec.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['CiJobTrace'], feature_category: :continuous_integration do
+ include GraphqlHelpers
+
+ let_it_be(:job) { create(:ci_build) }
+
+ it 'has the correct fields' do
+ expected_fields = [:html_summary]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+
+ it 'shows the correct trace contents' do
+ job.trace.set('BUILD TRACE')
+
+ expect_next_instance_of(Gitlab::Ci::Trace) do |trace|
+ expect(trace).to receive(:html).with(last_lines: 10).and_call_original
+ end
+
+ resolved_field = resolve_field(:html_summary, job.trace)
+
+ expect(resolved_field).to eq("<span>BUILD TRACE</span>")
+ end
+end