diff options
Diffstat (limited to 'spec/serializers')
3 files changed, 27 insertions, 10 deletions
diff --git a/spec/serializers/ci/codequality_mr_diff_entity_spec.rb b/spec/serializers/ci/codequality_mr_diff_entity_spec.rb index 82708908d95..4f161c36b06 100644 --- a/spec/serializers/ci/codequality_mr_diff_entity_spec.rb +++ b/spec/serializers/ci/codequality_mr_diff_entity_spec.rb @@ -4,18 +4,18 @@ require 'spec_helper' RSpec.describe Ci::CodequalityMrDiffEntity do let(:entity) { described_class.new(mr_diff_report) } - let(:mr_diff_report) { Gitlab::Ci::Reports::CodequalityMrDiff.new(codequality_report) } + let(:mr_diff_report) { Gitlab::Ci::Reports::CodequalityMrDiff.new(codequality_report.all_degradations) } let(:codequality_report) { Gitlab::Ci::Reports::CodequalityReports.new } - let(:degradation_1) { build(:codequality_degradation_1) } - let(:degradation_2) { build(:codequality_degradation_2) } + let(:major) { build(:codequality_degradation, :major) } + let(:minor) { build(:codequality_degradation, :minor) } describe '#as_json' do subject(:report) { entity.as_json } context 'when quality report has degradations' do before do - codequality_report.add_degradation(degradation_1) - codequality_report.add_degradation(degradation_2) + codequality_report.add_degradation(major) + codequality_report.add_degradation(minor) end it 'contains correct codequality mr diff report', :aggregate_failures do diff --git a/spec/serializers/ci/codequality_mr_diff_report_serializer_spec.rb b/spec/serializers/ci/codequality_mr_diff_report_serializer_spec.rb index 906ca36041f..6afbc3b8353 100644 --- a/spec/serializers/ci/codequality_mr_diff_report_serializer_spec.rb +++ b/spec/serializers/ci/codequality_mr_diff_report_serializer_spec.rb @@ -4,18 +4,18 @@ require 'spec_helper' RSpec.describe Ci::CodequalityMrDiffReportSerializer do let(:serializer) { described_class.new.represent(mr_diff_report) } - let(:mr_diff_report) { Gitlab::Ci::Reports::CodequalityMrDiff.new(codequality_report) } + let(:mr_diff_report) { Gitlab::Ci::Reports::CodequalityMrDiff.new(codequality_report.all_degradations) } let(:codequality_report) { Gitlab::Ci::Reports::CodequalityReports.new } - let(:degradation_1) { build(:codequality_degradation_1) } - let(:degradation_2) { build(:codequality_degradation_2) } + let(:major) { build(:codequality_degradation, :major) } + let(:minor) { build(:codequality_degradation, :minor) } describe '#to_json' do subject { serializer.as_json } context 'when quality report has degradations' do before do - codequality_report.add_degradation(degradation_1) - codequality_report.add_degradation(degradation_2) + codequality_report.add_degradation(major) + codequality_report.add_degradation(minor) end it 'matches the schema' do diff --git a/spec/serializers/group_issuable_autocomplete_entity_spec.rb b/spec/serializers/group_issuable_autocomplete_entity_spec.rb new file mode 100644 index 00000000000..86ef9dea23b --- /dev/null +++ b/spec/serializers/group_issuable_autocomplete_entity_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe GroupIssuableAutocompleteEntity do + let(:group) { build_stubbed(:group) } + let(:project) { build_stubbed(:project, group: group) } + let(:issue) { build_stubbed(:issue, project: project) } + + describe '#represent' do + subject { described_class.new(issue, parent_group: group).as_json } + + it 'includes the iid, title, and reference' do + expect(subject).to include(:iid, :title, :reference) + end + end +end |