Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-29 12:06:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-29 12:06:31 +0300
commit6b13a226ddfc49140d58e7e88f8703ae0ed90574 (patch)
tree9a92431e484354f43230fa87adc00a2edbf6f09c /spec/models/deployment_spec.rb
parent2ac93cb80c4c0a57fde86de8262b569d1e9b9e51 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r--spec/models/deployment_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index 268542c39c4..522a27954e2 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -442,4 +442,36 @@ describe Deployment do
expect(deploy2.previous_environment_deployment).to be_nil
end
end
+
+ describe '#playable_build' do
+ subject { deployment.playable_build }
+
+ context 'when there is a deployable build' do
+ let(:deployment) { create(:deployment, deployable: build) }
+
+ context 'when the deployable build is playable' do
+ let(:build) { create(:ci_build, :playable) }
+
+ it 'returns that build' do
+ is_expected.to eq(build)
+ end
+ end
+
+ context 'when the deployable build is not playable' do
+ let(:build) { create(:ci_build) }
+
+ it 'returns nil' do
+ is_expected.to be_nil
+ end
+ end
+ end
+
+ context 'when there is no deployable build' do
+ let(:deployment) { create(:deployment) }
+
+ it 'returns nil' do
+ is_expected.to be_nil
+ end
+ end
+ end
end