Make ChatNames::FindUserService stable by not checking a precise time

Signed-off-by: Rémy Coutable <remy@rymai.me>
This commit is contained in:
Rémy Coutable 2017-03-29 09:44:44 +02:00
parent 839183f2cb
commit 1cc9bf869f
No known key found for this signature in database
GPG key ID: 46DF07E5CD9E96AB

View file

@ -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