diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-02-22 18:34:04 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-02-23 14:37:53 +0100 |
commit | 57719d34d3fcc15f39354b0e9dc1da41bbe5d1a8 (patch) | |
tree | 255d9a3df371793748c64792a715102dca98512c /spec/models | |
parent | c679fa163148601e77803f45cf5dea8e1b3feb0a (diff) | |
download | gitlab-ce-57719d34d3fcc15f39354b0e9dc1da41bbe5d1a8.tar.gz |
Expose ChatName objects to slash commandsslash-commands-changes-for-chatops
Instead of only exposing a User to slash commands we now also expose the
ChatName object that the User object is retrieved from. This is
necessary for GitLab Chatops as we need for example the user ID of the
chat user.
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/chat_name_spec.rb | 20 |
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 |