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/diff_discussion_spec.rb')
-rw-r--r--spec/models/diff_discussion_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/models/diff_discussion_spec.rb b/spec/models/diff_discussion_spec.rb
index 2a2663149d0..998204626d3 100644
--- a/spec/models/diff_discussion_spec.rb
+++ b/spec/models/diff_discussion_spec.rb
@@ -126,4 +126,13 @@ RSpec.describe DiffDiscussion do
end
end
end
+
+ describe '#cache_key' do
+ it 'returns the cache key with the position sha' do
+ notes_sha = Digest::SHA1.hexdigest("#{diff_note.id}")
+ position_sha = Digest::SHA1.hexdigest(diff_note.position.to_json)
+
+ expect(subject.cache_key).to eq("#{described_class::CACHE_VERSION}:#{diff_note.latest_cached_markdown_version}:#{subject.id}:#{notes_sha}:#{diff_note.updated_at}::#{position_sha}")
+ end
+ end
end