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/concerns/cache_markdown_field_spec.rb')
-rw-r--r--spec/models/concerns/cache_markdown_field_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/concerns/cache_markdown_field_spec.rb b/spec/models/concerns/cache_markdown_field_spec.rb
index 06d12c14793..697a9e98505 100644
--- a/spec/models/concerns/cache_markdown_field_spec.rb
+++ b/spec/models/concerns/cache_markdown_field_spec.rb
@@ -230,6 +230,26 @@ describe CacheMarkdownField, :clean_gitlab_redis_cache do
end
end
end
+
+ describe '#rendered_field_content' do
+ let(:thing) { klass.new(description: markdown, description_html: nil, cached_markdown_version: cache_version) }
+
+ context 'when a field can be cached' do
+ it 'returns the html' do
+ thing.description = updated_markdown
+
+ expect(thing.rendered_field_content(:description)).to eq updated_html
+ end
+ end
+
+ context 'when a field cannot be cached' do
+ it 'returns nil' do
+ allow(thing).to receive(:can_cache_field?).with(:description).and_return false
+
+ expect(thing.rendered_field_content(:description)).to eq nil
+ end
+ end
+ end
end
context 'for Active record classes' do