summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-02-27 10:20:09 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-02-27 10:20:09 +0000
commit60503057bcf357bef82e3e61072d2a2646f62279 (patch)
tree48e234ba8450dd8786c42bcfa157987a5ec0b567 /spec/models
parenta4885b8f37602c399efff028b0a733ef80fbe7ab (diff)
parent57719d34d3fcc15f39354b0e9dc1da41bbe5d1a8 (diff)
downloadgitlab-ce-60503057bcf357bef82e3e61072d2a2646f62279.tar.gz
Merge branch 'slash-commands-changes-for-chatops' into 'master'
Expose ChatName objects to slash commands See merge request gitlab-org/gitlab-ce!17295
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/chat_name_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/chat_name_spec.rb b/spec/models/chat_name_spec.rb
index e89e534d914..504bc710b25 100644
--- a/spec/models/chat_name_spec.rb
+++ b/spec/models/chat_name_spec.rb
@@ -14,4 +14,24 @@ describe ChatName do
it { is_expected.to validate_uniqueness_of(:user_id).scoped_to(:service_id) }
it { is_expected.to validate_uniqueness_of(:chat_id).scoped_to(:service_id, :team_id) }
+
+ describe '#update_last_used_at', :clean_gitlab_redis_shared_state do
+ it 'updates the last_used_at timestamp' do
+ expect(subject.last_used_at).to be_nil
+
+ subject.update_last_used_at
+
+ expect(subject.last_used_at).to be_present
+ end
+
+ it 'does not update last_used_at if it was recently updated' do
+ subject.update_last_used_at
+
+ time = subject.last_used_at
+
+ subject.update_last_used_at
+
+ expect(subject.last_used_at).to eq(time)
+ end
+ end
end