Rails 5: fix mysql milliseconds problems in scheduled build specs

This commit is contained in:
Jasper Maes 2018-10-06 13:21:47 +02:00
parent 50c9a09a04
commit 043f899b2a
4 changed files with 8 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
title: 'Rails 5: fix mysql milliseconds problems in scheduled build specs'
merge_request: 22170
author: Jasper Maes
type: other

View file

@ -17,7 +17,7 @@ describe Gitlab::Ci::Status::Build::Scheduled do
let(:build) { create(:ci_build, scheduled_at: 1.minute.since, project: project) }
it 'shows execute_in of the scheduled job' do
Timecop.freeze do
Timecop.freeze(Time.now.change(usec: 0)) do
expect(subject.status_tooltip).to include('00:01:00')
end
end

View file

@ -261,7 +261,7 @@ describe Ci::Build do
it 'schedules BuildScheduleWorker at the right time' do
Timecop.freeze do
expect(Ci::BuildScheduleWorker)
.to receive(:perform_at).with(1.minute.since, build.id)
.to receive(:perform_at).with(be_like_time(1.minute.since), build.id)
subject
end

View file

@ -227,7 +227,7 @@ describe Ci::BuildPresenter do
it 'returns execution time' do
Timecop.freeze do
is_expected.to eq(60.0)
is_expected.to be_like_time(60.0)
end
end
end