Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/chat_name_spec.rb')
-rw-r--r--spec/models/chat_name_spec.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/models/chat_name_spec.rb b/spec/models/chat_name_spec.rb
index 9d6b1a56458..dbe013f3872 100644
--- a/spec/models/chat_name_spec.rb
+++ b/spec/models/chat_name_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe ChatName, feature_category: :integrations do
- let_it_be(:chat_name) { create(:chat_name) }
+ let_it_be_with_reload(:chat_name) { create(:chat_name) }
subject { chat_name }
@@ -33,6 +33,22 @@ RSpec.describe ChatName, feature_category: :integrations do
expect(subject.last_used_at).to eq(time)
end
+
+ it 'updates last_used_at if it was not recently updated' do
+ allow_next_instance_of(Gitlab::ExclusiveLease) do |lease|
+ allow(lease).to receive(:try_obtain).and_return('successful_lease_guid')
+ end
+
+ subject.update_last_used_at
+
+ new_time = ChatName::LAST_USED_AT_INTERVAL.from_now + 5.minutes
+
+ travel_to(new_time) do
+ subject.update_last_used_at
+ end
+
+ expect(subject.last_used_at).to be_like_time(new_time)
+ end
end
it_behaves_like 'it has loose foreign keys' do