diff options
Diffstat (limited to 'spec/serializers/ci/job_annotation_entity_spec.rb')
-rw-r--r-- | spec/serializers/ci/job_annotation_entity_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/serializers/ci/job_annotation_entity_spec.rb b/spec/serializers/ci/job_annotation_entity_spec.rb new file mode 100644 index 00000000000..8aef6e8cce3 --- /dev/null +++ b/spec/serializers/ci/job_annotation_entity_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ci::JobAnnotationEntity, feature_category: :build_artifacts do + let(:entity) { described_class.new(annotation) } + + let(:job) { build(:ci_build) } + let(:annotation) do + build(:ci_job_annotation, job: job, name: 'external_links', data: + [{ external_link: { label: 'URL', url: 'https://example.com/' } }]) + end + + describe '#as_json' do + subject { entity.as_json } + + it 'contains valid name' do + expect(subject[:name]).to eq 'external_links' + end + + it 'contains external links' do + expect(subject[:data]).to include(a_hash_including( + 'external_link' => a_hash_including( + 'label' => 'URL', + 'url' => 'https://example.com/' + ) + )) + end + end +end |