Commit 0a2649ce authored by Timothy Andrew's avatar Timothy Andrew

Fix build.

parent b5dc0c6d
...@@ -197,13 +197,13 @@ describe Ci::Pipeline, models: true do ...@@ -197,13 +197,13 @@ describe Ci::Pipeline, models: true do
time = Time.now time = Time.now
Timecop.freeze(time) { build.run } Timecop.freeze(time) { build.run }
expect(merge_request.metrics.latest_build_started_at).to be_within(1.second).of(time) expect(merge_request.reload.metrics.latest_build_started_at).to be_within(1.second).of(time)
end end
it 'clears the build end time' do it 'clears the build end time' do
build.run build.run
expect(merge_request.metrics.latest_build_finished_at).to be_nil expect(merge_request.reload.metrics.latest_build_finished_at).to be_nil
end end
end end
...@@ -213,7 +213,7 @@ describe Ci::Pipeline, models: true do ...@@ -213,7 +213,7 @@ describe Ci::Pipeline, models: true do
time = Time.now time = Time.now
Timecop.freeze(time) { build.success } Timecop.freeze(time) { build.success }
expect(merge_request.metrics.latest_build_finished_at).to be_within(1.second).of(time) expect(merge_request.reload.metrics.latest_build_finished_at).to be_within(1.second).of(time)
end end
end end
end end
......
...@@ -190,7 +190,7 @@ describe CreateDeploymentService, services: true do ...@@ -190,7 +190,7 @@ describe CreateDeploymentService, services: true do
time = Time.now time = Time.now
Timecop.freeze(time) { service.execute } Timecop.freeze(time) { service.execute }
expect(merge_request.metrics.first_deployed_to_production_at).to be_within(1.second).of(time) expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_within(1.second).of(time)
end end
it "doesn't set the time if the deploy's environment is not 'production'" do it "doesn't set the time if the deploy's environment is not 'production'" do
...@@ -198,7 +198,7 @@ describe CreateDeploymentService, services: true do ...@@ -198,7 +198,7 @@ describe CreateDeploymentService, services: true do
service = described_class.new(project, user, staging_params) service = described_class.new(project, user, staging_params)
service.execute service.execute
expect(merge_request.metrics.first_deployed_to_production_at).to be_nil expect(merge_request.reload.metrics.first_deployed_to_production_at).to be_nil
end end
it 'does not raise errors if the merge request does not have a metrics record' do it 'does not raise errors if the merge request does not have a metrics record' do
...@@ -231,7 +231,7 @@ describe CreateDeploymentService, services: true do ...@@ -231,7 +231,7 @@ describe CreateDeploymentService, services: true do
# Previous deploy # Previous deploy
time = Time.now time = Time.now
Timecop.freeze(time) { service.execute } Timecop.freeze(time) { service.execute }
merge_request.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
......
...@@ -364,14 +364,14 @@ describe GitPushService, services: true do ...@@ -364,14 +364,14 @@ describe GitPushService, services: true do
it 'sets the metric for referenced issues' do it 'sets the metric for referenced issues' do
execute_service(project, user, @oldrev, @newrev, @ref) execute_service(project, user, @oldrev, @newrev, @ref)
expect(issue.metrics.first_mentioned_in_commit_at).to be_within(1.second).of(commit_time) expect(issue.reload.metrics.first_mentioned_in_commit_at).to be_within(1.second).of(commit_time)
end end
it 'does not set the metric for non-referenced issues' do it 'does not set the metric for non-referenced issues' do
non_referenced_issue = create(:issue, project: project) non_referenced_issue = create(:issue, project: project)
execute_service(project, user, @oldrev, @newrev, @ref) execute_service(project, user, @oldrev, @newrev, @ref)
expect(non_referenced_issue.metrics.first_mentioned_in_commit_at).to be_nil expect(non_referenced_issue.reload.metrics.first_mentioned_in_commit_at).to be_nil
end 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