summaryrefslogtreecommitdiff
path: root/spec/services/update_deployment_service_spec.rb
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-11-06 14:26:36 +0900
committerShinya Maeda <shinya@gitlab.com>2018-11-06 14:26:36 +0900
commitee373f28a1b0c0ac073354df2585ee7ede0ee676 (patch)
treef82327d6d11d9d691e05e5f7fd6b2ea2d575ed7b /spec/services/update_deployment_service_spec.rb
parent65a7a6e5a26cd4a5141a12f6694e4897336e46b9 (diff)
downloadgitlab-ce-ee373f28a1b0c0ac073354df2585ee7ede0ee676.tar.gz
Fix flaky spec
Diffstat (limited to 'spec/services/update_deployment_service_spec.rb')
-rw-r--r--spec/services/update_deployment_service_spec.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/services/update_deployment_service_spec.rb b/spec/services/update_deployment_service_spec.rb
index b963a84ca0c..3c55dd9659a 100644
--- a/spec/services/update_deployment_service_spec.rb
+++ b/spec/services/update_deployment_service_spec.rb
@@ -182,15 +182,16 @@ describe UpdateDeploymentService do
context "if the 'first_deployed_to_production_at' time is already set" do
it "does not overwrite the older 'first_deployed_to_production_at' time" do
# Previous deploy
- time = Time.now
- Timecop.freeze(time) { service.execute }
+ service.execute
- expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_like_time(time)
+ expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_like_time(deployment.finished_at)
# Current deploy
- Timecop.freeze(time + 12.hours) { service.execute }
+ Timecop.travel(12.hours.from_now) do
+ service.execute
- expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_like_time(time)
+ expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_like_time(deployment.finished_at)
+ end
end
end