Commit ee373f28 authored by Shinya Maeda's avatar Shinya Maeda

Fix flaky spec

parent 65a7a6e5
...@@ -182,15 +182,16 @@ ...@@ -182,15 +182,16 @@
context "if the 'first_deployed_to_production_at' time is already set" 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 it "does not overwrite the older 'first_deployed_to_production_at' time" do
# Previous deploy # Previous deploy
time = Time.now service.execute
Timecop.freeze(time) { 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 # 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
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment