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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-29 00:09:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-29 00:09:15 +0300
commit8831c2df7fa3f1bb567e284e4b8c0a4f441e74b3 (patch)
tree36b1b430075ff6e63524be14585dbb614e893e8c /spec/models/concerns/cache_markdown_field_spec.rb
parent1c8fa70f9d0818e2a82089c8643a6e455bca47fd (diff)
Add latest changes from gitlab-org/gitlab@master
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