Fix flaky spec
This commit is contained in:
parent
65a7a6e5a2
commit
ee373f28a1
1 changed files with 6 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue