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/lib/gitlab/markdown_cache/redis/store_spec.rb')
-rw-r--r--spec/lib/gitlab/markdown_cache/redis/store_spec.rb24
1 files changed, 21 insertions, 3 deletions
diff --git a/spec/lib/gitlab/markdown_cache/redis/store_spec.rb b/spec/lib/gitlab/markdown_cache/redis/store_spec.rb
index 95c68e7d491..40ff9a765a6 100644
--- a/spec/lib/gitlab/markdown_cache/redis/store_spec.rb
+++ b/spec/lib/gitlab/markdown_cache/redis/store_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'spec_helper'
-describe Gitlab::MarkdownCache::Redis::Store, :clean_gitlab_redis_cache do
+RSpec.describe Gitlab::MarkdownCache::Redis::Store, :clean_gitlab_redis_cache do
let(:storable_class) do
Class.new do
cattr_reader :cached_markdown_fields do
@@ -37,6 +37,23 @@ describe Gitlab::MarkdownCache::Redis::Store, :clean_gitlab_redis_cache do
end
end
+ describe '.bulk_read' do
+ before do
+ store.save(field_1_html: "hello", field_2_html: "world", cached_markdown_version: 1)
+ end
+
+ it 'returns a hash of values from store' do
+ Gitlab::Redis::Cache.with do |redis|
+ expect(redis).to receive(:pipelined).and_call_original
+ end
+
+ results = described_class.bulk_read([storable])
+
+ expect(results[storable.cache_key].value.symbolize_keys)
+ .to eq(field_1_html: "hello", field_2_html: "world", cached_markdown_version: "1")
+ end
+ end
+
describe '#save' do
it 'stores updates to html fields and version' do
values_to_store = { field_1_html: "hello", field_2_html: "world", cached_markdown_version: 1 }
@@ -44,7 +61,7 @@ describe Gitlab::MarkdownCache::Redis::Store, :clean_gitlab_redis_cache do
store.save(values_to_store)
expect(read_values)
- .to eq({ field_1_html: "hello", field_2_html: "world", cached_markdown_version: "1" })
+ .to eq(field_1_html: "hello", field_2_html: "world", cached_markdown_version: "1")
end
end
@@ -54,7 +71,8 @@ describe Gitlab::MarkdownCache::Redis::Store, :clean_gitlab_redis_cache do
store_values(stored_values)
- expect(store.read.symbolize_keys).to eq(stored_values)
+ expect(store.read.symbolize_keys)
+ .to eq(field_1_html: "hello", field_2_html: "world", cached_markdown_version: "1")
end
it 'is mared loaded after reading' do