summaryrefslogtreecommitdiff
path: root/spec/models/ci/processable_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-26 15:08:56 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-26 15:08:56 +0000
commit17ab40ca089e1aef61a83f77ab6df62a72f6ce06 (patch)
tree8eb149293eee90ec2750b6ac5e46a111a806424e /spec/models/ci/processable_spec.rb
parent66d4203791a01fdedf668a78818a229ea2c07aad (diff)
downloadgitlab-ce-17ab40ca089e1aef61a83f77ab6df62a72f6ce06.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/ci/processable_spec.rb')
-rw-r--r--spec/models/ci/processable_spec.rb24
1 files changed, 24 insertions, 0 deletions
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