diff options
author | Rémy Coutable <remy@rymai.me> | 2017-03-29 09:44:44 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-03-29 11:12:13 +0200 |
commit | 1cc9bf869f599dafaad6705b19becab3bbd04ad8 (patch) | |
tree | 77b40670734900d228aee7ba85c0c761611ec0e3 /spec/services/chat_names/find_user_service_spec.rb | |
parent | 839183f2cbbed45bd2a8f8123bd01e2d2b509037 (diff) | |
download | gitlab-ce-1cc9bf869f599dafaad6705b19becab3bbd04ad8.tar.gz |
Make ChatNames::FindUserService stable by not checking a precise time
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/services/chat_names/find_user_service_spec.rb')
-rw-r--r-- | spec/services/chat_names/find_user_service_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/services/chat_names/find_user_service_spec.rb b/spec/services/chat_names/find_user_service_spec.rb index 51441e8f3be..0dc96521fa8 100644 --- a/spec/services/chat_names/find_user_service_spec.rb +++ b/spec/services/chat_names/find_user_service_spec.rb @@ -18,9 +18,16 @@ describe ChatNames::FindUserService, services: true do end it 'updates when last time chat name was used' do + expect(chat_name.last_used_at).to be_nil + subject - expect(chat_name.reload.last_used_at).to be_like_time(Time.now) + initial_last_used = chat_name.reload.last_used_at + expect(initial_last_used).to be_present + + Timecop.travel(2.days.from_now) { described_class.new(service, params).execute } + + expect(chat_name.reload.last_used_at).to be > initial_last_used end end |