summaryrefslogtreecommitdiff
path: root/spec/models/deployment_spec.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-10-13 14:19:52 +0100
committerSean McGivern <sean@gitlab.com>2016-10-13 16:15:38 +0100
commit776cea4c00d883cafc2bc5381f3b61b146a93976 (patch)
tree469990cf140f9558320a5aab9c1ca46850c17a98 /spec/models/deployment_spec.rb
parenta053430e94e21bbf81524304f9b52a106f654b54 (diff)
downloadgitlab-ce-776cea4c00d883cafc2bc5381f3b61b146a93976.tar.gz
Handle case where deployment ref no longer exists22655-deployments-don-t-always-have-keep-around-refs
Keep-around refs for deployments were only introduced in 8.10, so any deployment created in 8.9 could have a SHA pointing to a commit that no longer exists in the repository. We can't do anything useful with those deployments, so make `#includes_commit?` always return false for those.
Diffstat (limited to 'spec/models/deployment_spec.rb')
-rw-r--r--spec/models/deployment_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb
index bfff639ad78..01a4a53a264 100644
--- a/spec/models/deployment_spec.rb
+++ b/spec/models/deployment_spec.rb
@@ -38,5 +38,14 @@ describe Deployment, models: true do
expect(deployment.includes_commit?(commit)).to be true
end
end
+
+ context 'when the SHA for the deployment does not exist in the repo' do
+ it 'returns false' do
+ deployment.update(sha: Gitlab::Git::BLANK_SHA)
+ commit = project.commit
+
+ expect(deployment.includes_commit?(commit)).to be false
+ end
+ end
end
end