diff options
author | Sean McGivern <sean@gitlab.com> | 2019-02-07 14:48:59 +0000 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-02-07 14:48:59 +0000 |
commit | 232ae06a829ba1a7e795564f711e730bd839be41 (patch) | |
tree | 937aef3a48aa6ea6148c5fdbb2b880012d43a8ad | |
parent | c8fe0d6a8a76ee5865c71b5b6627608e5075797d (diff) | |
parent | 28c48804be86c1fbd0bbc16f33cbe4912ca65cce (diff) | |
download | gitlab-ce-232ae06a829ba1a7e795564f711e730bd839be41.tar.gz |
Merge branch 'sh-fix-ee-issue-8871' into 'master'
Fix failing test in spec/workers/post_receive_spec.rb
Closes gitlab-ee#8871
See merge request gitlab-org/gitlab-ce!24993
-rw-r--r-- | spec/workers/post_receive_spec.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 9176eb12b12..caae46a3175 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -141,11 +141,18 @@ describe PostReceive do let(:gl_repository) { "wiki-#{project.id}" } it 'updates project activity' do - described_class.new.perform(gl_repository, key_id, base64_changes) + # Force Project#set_timestamps_for_create to initialize timestamps + project - expect { project.reload } - .to change(project, :last_activity_at) - .and change(project, :last_repository_updated_at) + # MySQL drops milliseconds in the timestamps, so advance at least + # a second to ensure we see changes. + Timecop.freeze(1.second.from_now) do + expect do + described_class.new.perform(gl_repository, key_id, base64_changes) + project.reload + end.to change(project, :last_activity_at) + .and change(project, :last_repository_updated_at) + end end end |