Merge branch 'rails5-fix-48977' into 'master'

Rails5 fix mysql milliseconds problem in specs

Closes #48977

See merge request gitlab-org/gitlab-ce!20464
This commit is contained in:
Rémy Coutable 2018-07-09 16:02:56 +00:00
commit e2f7fbe439
3 changed files with 18 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
title: Rails5 fix mysql milliseconds problem in specs
merge_request: 20464
author: Jasper Maes
type: fixed

View file

@ -2461,7 +2461,9 @@ describe User do
it 'changes the namespace (just to compare to when username is not changed)' do
expect do
user.update_attributes!(username: new_username)
Timecop.freeze(1.second.from_now) do
user.update_attributes!(username: new_username)
end
end.to change { user.namespace.updated_at }
end

View file

@ -100,7 +100,11 @@ describe Ci::RetryBuildService do
end
describe '#execute' do
let(:new_build) { service.execute(build) }
let(:new_build) do
Timecop.freeze(1.second.from_now) do
service.execute(build)
end
end
context 'when user has ability to execute build' do
before do
@ -150,7 +154,11 @@ describe Ci::RetryBuildService do
end
describe '#reprocess' do
let(:new_build) { service.reprocess!(build) }
let(:new_build) do
Timecop.freeze(1.second.from_now) do
service.reprocess!(build)
end
end
context 'when user has ability to execute build' do
before do