Fix CreateDeploymentService spec.

1. The spec tests that if:

  - The merge request is merged
  - The target branch is deployed to production
  - The `first_deployed_to_production_at` metric is `nil` (for some reason)
  - The target branch is deployed to production again
  - The `first_deployed_to_production_at` metric stays as `nil` (and is
    not overwritten).

2. Failure only on MySQL due to some datetime weirdness.
This commit is contained in:
Timothy Andrew 2016-09-21 09:17:00 +05:30
parent ef8badb6a7
commit cc3adcd4bf

View file

@ -229,8 +229,11 @@ describe CreateDeploymentService, services: true do
context "if the 'first_deployed_to_production_at' time is not already set" do context "if the 'first_deployed_to_production_at' time is not 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 time = 5.minutes.from_now
Timecop.freeze(time) { service.execute } Timecop.freeze(time) { service.execute }
expect(merge_request.reload.metrics.merged_at).to be < merge_request.reload.metrics.first_deployed_to_production_at
merge_request.reload.metrics.update(first_deployed_to_production_at: nil) merge_request.reload.metrics.update(first_deployed_to_production_at: nil)
expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_nil expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_nil