diff options
Diffstat (limited to 'spec/serializers/build_artifact_entity_spec.rb')
-rw-r--r-- | spec/serializers/build_artifact_entity_spec.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/serializers/build_artifact_entity_spec.rb b/spec/serializers/build_artifact_entity_spec.rb index 87c1874ec41..3d4dc3f69c9 100644 --- a/spec/serializers/build_artifact_entity_spec.rb +++ b/spec/serializers/build_artifact_entity_spec.rb @@ -3,11 +3,13 @@ require 'spec_helper' RSpec.describe BuildArtifactEntity do - let(:job) { create(:ci_build) } - let(:artifact) { create(:ci_job_artifact, :codequality, expire_at: 1.hour.from_now, job: job) } + let_it_be(:job) { create(:ci_build) } + let_it_be(:artifact) { create(:ci_job_artifact, :codequality, expire_at: 1.hour.from_now, job: job) } + + let(:options) { { request: double } } let(:entity) do - described_class.new(artifact, request: double) + described_class.represent(artifact, options) end describe '#as_json' do @@ -46,5 +48,15 @@ RSpec.describe BuildArtifactEntity do expect(subject[:browse_path]).to be_present end end + + context 'when project is specified in options' do + let(:options) { super().merge(project: job.project) } + + it 'doesnt get a project from the artifact' do + expect(artifact).not_to receive(:project) + + subject + end + end end end |