summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelogs/unreleased/rails5-mysql-schedule-build.yml5
-rw-r--r--spec/lib/gitlab/ci/status/build/scheduled_spec.rb2
-rw-r--r--spec/models/ci/build_spec.rb2
-rw-r--r--spec/presenters/ci/build_presenter_spec.rb2
4 files changed, 8 insertions, 3 deletions
diff --git a/changelogs/unreleased/rails5-mysql-schedule-build.yml b/changelogs/unreleased/rails5-mysql-schedule-build.yml
new file mode 100644
index 00000000000..cbc481fbf89
--- /dev/null
+++ b/changelogs/unreleased/rails5-mysql-schedule-build.yml
@@ -0,0 +1,5 @@
+---
+title: 'Rails 5: fix mysql milliseconds problems in scheduled build specs'
+merge_request: 22170
+author: Jasper Maes
+type: other
diff --git a/spec/lib/gitlab/ci/status/build/scheduled_spec.rb b/spec/lib/gitlab/ci/status/build/scheduled_spec.rb
index 3098a17c50d..f98183d6d18 100644
--- a/spec/lib/gitlab/ci/status/build/scheduled_spec.rb
+++ b/spec/lib/gitlab/ci/status/build/scheduled_spec.rb
@@ -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
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index cebc822d525..a046541031e 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -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
diff --git a/spec/presenters/ci/build_presenter_spec.rb b/spec/presenters/ci/build_presenter_spec.rb
index b2fe10bb0b0..d7992f0a4a9 100644
--- a/spec/presenters/ci/build_presenter_spec.rb
+++ b/spec/presenters/ci/build_presenter_spec.rb
@@ -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