diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/models/note_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) | |
download | gitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/models/note_spec.rb')
-rw-r--r-- | spec/models/note_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index 2afe9a0f29b..0afdae2fc93 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -1538,4 +1538,24 @@ RSpec.describe Note do expect(attachment).not_to be_exist end end + + describe '#post_processed_cache_key' do + let(:note) { build(:note) } + + it 'returns cache key and author cache key by default' do + expect(note.post_processed_cache_key).to eq("#{note.cache_key}:#{note.author.cache_key}") + end + + context 'when note has redacted_note_html' do + let(:redacted_note_html) { 'redacted note html' } + + before do + note.redacted_note_html = redacted_note_html + end + + it 'returns cache key with redacted_note_html sha' do + expect(note.post_processed_cache_key).to eq("#{note.cache_key}:#{note.author.cache_key}:#{Digest::SHA1.hexdigest(redacted_note_html)}") + end + end + end end |