diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 12:06:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 12:06:09 +0300 |
commit | 77a7772c3bdb03d92cbc154f6b1a762953cc7c19 (patch) | |
tree | b841c2233afb01d1b6cc7dd4023f2b677ec19eb3 /spec/serializers | |
parent | f7234a0894db99c7ade3cf29c1b467aa4807cc41 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/test_report_entity_spec.rb | 25 | ||||
-rw-r--r-- | spec/serializers/test_suite_entity_spec.rb | 29 |
2 files changed, 54 insertions, 0 deletions
diff --git a/spec/serializers/test_report_entity_spec.rb b/spec/serializers/test_report_entity_spec.rb new file mode 100644 index 00000000000..5913d1c0208 --- /dev/null +++ b/spec/serializers/test_report_entity_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe TestReportEntity do + let(:pipeline) { create(:ci_pipeline, :with_test_reports) } + let(:entity) { described_class.new(pipeline.test_reports) } + + describe '#as_json' do + subject(:as_json) { entity.as_json } + + it 'contains the total time' do + expect(as_json).to include(:total_time) + end + + it 'contains the counts' do + expect(as_json).to include(:total_count, :success_count, :failed_count, :skipped_count, :error_count) + end + + it 'contains the test suites' do + expect(as_json).to include(:test_suites) + expect(as_json[:test_suites].count).to eq(1) + end + end +end diff --git a/spec/serializers/test_suite_entity_spec.rb b/spec/serializers/test_suite_entity_spec.rb new file mode 100644 index 00000000000..54dca3214b7 --- /dev/null +++ b/spec/serializers/test_suite_entity_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe TestSuiteEntity do + let(:pipeline) { create(:ci_pipeline, :with_test_reports) } + let(:entity) { described_class.new(pipeline.test_reports.test_suites.values.first) } + + describe '#as_json' do + subject(:as_json) { entity.as_json } + + it 'contains the suite name' do + expect(as_json).to include(:name) + end + + it 'contains the total time' do + expect(as_json).to include(:total_time) + end + + it 'contains the counts' do + expect(as_json).to include(:total_count, :success_count, :failed_count, :skipped_count, :error_count) + end + + it 'contains the test cases' do + expect(as_json).to include(:test_cases) + expect(as_json[:test_cases].count).to eq(4) + end + end +end |