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/serializers/ci/dag_stage_entity_spec.rb')
-rw-r--r--spec/serializers/ci/dag_stage_entity_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/serializers/ci/dag_stage_entity_spec.rb b/spec/serializers/ci/dag_stage_entity_spec.rb
new file mode 100644
index 00000000000..5c6aa7faee4
--- /dev/null
+++ b/spec/serializers/ci/dag_stage_entity_spec.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Ci::DagStageEntity do
+ let_it_be(:pipeline) { create(:ci_pipeline) }
+ let_it_be(:request) { double(:request) }
+
+ let(:stage) { build(:ci_stage, pipeline: pipeline, name: 'test') }
+ let(:entity) { described_class.new(stage, request: request) }
+
+ let!(:job) { create(:ci_build, :success, pipeline: pipeline) }
+
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ it 'contains valid name' do
+ expect(subject[:name]).to eq 'test'
+ end
+
+ it 'contains the job groups' do
+ expect(subject).to include :groups
+ expect(subject[:groups]).not_to be_empty
+
+ job_group = subject[:groups].first
+ expect(job_group[:name]).to eq 'test'
+ expect(job_group[:size]).to eq 1
+ expect(job_group[:jobs]).not_to be_empty
+ end
+ end
+end