From 17ab40ca089e1aef61a83f77ab6df62a72f6ce06 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 26 Feb 2020 15:08:56 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- spec/models/ci/processable_spec.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'spec/models/ci/processable_spec.rb') diff --git a/spec/models/ci/processable_spec.rb b/spec/models/ci/processable_spec.rb index 1e0544c14c5..e03f54aa728 100644 --- a/spec/models/ci/processable_spec.rb +++ b/spec/models/ci/processable_spec.rb @@ -145,4 +145,28 @@ describe Ci::Processable do expect(another_build.reload.scheduling_type).to be_nil end end + + describe '#needs_attributes' do + let(:build) { create(:ci_build, :created, project: project, pipeline: pipeline) } + + context 'with needs' do + before do + create(:ci_build_need, build: build, name: 'test1') + create(:ci_build_need, build: build, name: 'test2') + end + + it 'returns all needs attributes' do + expect(build.needs_attributes).to contain_exactly( + { 'artifacts' => true, 'name' => 'test1' }, + { 'artifacts' => true, 'name' => 'test2' } + ) + end + end + + context 'without needs' do + it 'returns all needs attributes' do + expect(build.needs_attributes).to be_empty + end + end + end end -- cgit v1.2.1