diff options
author | Rémy Coutable <remy@rymai.me> | 2018-06-29 12:35:58 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-06-29 12:35:58 +0300 |
commit | 54692746c9e710e61952ddfa22ef84367a4c2b72 (patch) | |
tree | b7eb5234f4311cb5ba8cb60cede3bc1a6f27e147 | |
parent | 586045e2034f221944893b3d2482f440fa0d6c4b (diff) | |
parent | a5bd978ad7d856d4171a413e3a17b2ead4092dea (diff) |
Merge branch 'rails5-fix-48432' into 'master'
Rails5 fix Mysql comparison failure caused by milliseconds problem
Closes #48432
See merge request gitlab-org/gitlab-ce!20222
-rw-r--r-- | changelogs/unreleased/rails5-fix-48432.yml | 5 | ||||
-rw-r--r-- | spec/models/concerns/resolvable_discussion_spec.rb | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/changelogs/unreleased/rails5-fix-48432.yml b/changelogs/unreleased/rails5-fix-48432.yml new file mode 100644 index 00000000000..732294447a9 --- /dev/null +++ b/changelogs/unreleased/rails5-fix-48432.yml @@ -0,0 +1,5 @@ +--- +title: Rails5 fix Mysql comparison failure caused by milliseconds problem +merge_request: 20222 +author: Jasper Maes +type: fixed diff --git a/spec/models/concerns/resolvable_discussion_spec.rb b/spec/models/concerns/resolvable_discussion_spec.rb index 2a2ef5a304d..2f9f63ce7e0 100644 --- a/spec/models/concerns/resolvable_discussion_spec.rb +++ b/spec/models/concerns/resolvable_discussion_spec.rb @@ -534,11 +534,18 @@ describe Discussion, ResolvableDiscussion do describe "#last_resolved_note" do let(:current_user) { create(:user) } + let(:time) { Time.now.utc } before do - first_note.resolve!(current_user) - third_note.resolve!(current_user) - second_note.resolve!(current_user) + Timecop.freeze(time - 1.second) do + first_note.resolve!(current_user) + end + Timecop.freeze(time) do + third_note.resolve!(current_user) + end + Timecop.freeze(time + 1.second) do + second_note.resolve!(current_user) + end end it "returns the last note that was resolved" do |