summaryrefslogtreecommitdiff
path: root/spec/serializers/deployment_entity_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-11-06 15:43:24 +0000
committerDouwe Maan <douwe@gitlab.com>2018-11-06 15:43:24 +0000
commit1208d55206128266690f46f0165df0fc10c24941 (patch)
tree93fbdde5a5db6cdd8f79f2806707dab093985aa2 /spec/serializers/deployment_entity_spec.rb
parentd171ff60168cd55b6d7b9ee920269f44a26e577e (diff)
parentd0c58a97c8a053c0beec7c13c1c6ec5042120ef1 (diff)
downloadgitlab-ce-refactor-snippets-finder.tar.gz
Merge branch 'master' into 'refactor-snippets-finder'refactor-snippets-finder
# Conflicts: # spec/models/project_spec.rb
Diffstat (limited to 'spec/serializers/deployment_entity_spec.rb')
-rw-r--r--spec/serializers/deployment_entity_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/serializers/deployment_entity_spec.rb b/spec/serializers/deployment_entity_spec.rb
index 522c92ce295..8793a762f9d 100644
--- a/spec/serializers/deployment_entity_spec.rb
+++ b/spec/serializers/deployment_entity_spec.rb
@@ -22,4 +22,26 @@ describe DeploymentEntity do
it 'exposes creation date' do
expect(subject).to include(:created_at)
end
+
+ describe 'scheduled_actions' do
+ let(:project) { create(:project, :repository) }
+ let(:pipeline) { create(:ci_pipeline, project: project, user: user) }
+ let(:build) { create(:ci_build, :success, pipeline: pipeline) }
+ let(:deployment) { create(:deployment, deployable: build) }
+
+ context 'when the same pipeline has a scheduled action' do
+ let(:other_build) { create(:ci_build, :schedulable, :success, pipeline: pipeline, name: 'other build') }
+ let!(:other_deployment) { create(:deployment, deployable: other_build) }
+
+ it 'returns other scheduled actions' do
+ expect(subject[:scheduled_actions][0][:name]).to eq 'other build'
+ end
+ end
+
+ context 'when the same pipeline does not have a scheduled action' do
+ it 'does not return other actions' do
+ expect(subject[:scheduled_actions]).to be_empty
+ end
+ end
+ end
end