summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Maes <jaspermaes.jm@gmail.com>2018-07-07 13:46:23 +0200
committerJasper Maes <jaspermaes.jm@gmail.com>2018-07-07 19:33:16 +0200
commitfbb48bd7e9e20037bb5a1b79e70f68f2d4bc3170 (patch)
tree091e8774bdbb902f7fed73a53932fc2db00132cc
parent96eb6fd33b5dfc4910d8bd93e697d6b6eb70b991 (diff)
downloadgitlab-ce-fbb48bd7e9e20037bb5a1b79e70f68f2d4bc3170.tar.gz
Rails5 fix mysql milliseconds problem in specs
-rw-r--r--changelogs/unreleased/rails5-fix-48977.yml5
-rw-r--r--spec/models/user_spec.rb4
-rw-r--r--spec/services/ci/retry_build_service_spec.rb12
3 files changed, 18 insertions, 3 deletions
diff --git a/changelogs/unreleased/rails5-fix-48977.yml b/changelogs/unreleased/rails5-fix-48977.yml
new file mode 100644
index 00000000000..bfd86f20e24
--- /dev/null
+++ b/changelogs/unreleased/rails5-fix-48977.yml
@@ -0,0 +1,5 @@
+---
+title: Rails5 fix mysql milliseconds problem in specs
+merge_request: 20464
+author: Jasper Maes
+type: fixed
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 097144d04ce..57c408498dd 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -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
diff --git a/spec/services/ci/retry_build_service_spec.rb b/spec/services/ci/retry_build_service_spec.rb
index decb5d22f59..b8cdbc8c0f6 100644
--- a/spec/services/ci/retry_build_service_spec.rb
+++ b/spec/services/ci/retry_build_service_spec.rb
@@ -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