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/daily_build_group_report_result_entity_spec.rb')
-rw-r--r--spec/serializers/ci/daily_build_group_report_result_entity_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/serializers/ci/daily_build_group_report_result_entity_spec.rb b/spec/serializers/ci/daily_build_group_report_result_entity_spec.rb
new file mode 100644
index 00000000000..cc35b3bc8b8
--- /dev/null
+++ b/spec/serializers/ci/daily_build_group_report_result_entity_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe Ci::DailyBuildGroupReportResultEntity do
+ let(:report_result) { double(date: '2020-05-20', group_name: 'rspec', data: { 'coverage' => 79.1 }) }
+ let(:entity) { described_class.new(report_result, param_type: param_type) }
+ let(:param_type) { 'coverage' }
+
+ describe '#as_json' do
+ subject { entity.as_json }
+
+ it { is_expected.to include(:date) }
+
+ it { is_expected.not_to include(:group_name) }
+
+ it { is_expected.to include(:coverage) }
+
+ context 'when given param_type is not allowed' do
+ let(:param_type) { 'something_else' }
+
+ it { is_expected.not_to include(:coverage) }
+ it { is_expected.not_to include(:something_else) }
+ end
+ end
+end