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
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-12-12 19:02:54 +0300
committerSean McGivern <sean@mcgivern.me.uk>2017-12-12 19:02:54 +0300
commit2cbfc992c9005ed193b2d547a5537313dbf2ca0e (patch)
tree27e9b2243c4b0714eba9df88201c1e574a1dfe07 /spec
parentd673628de003d1ce1402f03311066339828fb811 (diff)
parente8ab4d92b410f46ca87d31a1376acd94f90d1dd9 (diff)
Merge branch 'optimize-issues-avoid-noop-empty-cache-updates2' into 'master'
Treat empty markdown and html strings as valid cached text, not missing cacheā€¦ See merge request gitlab-org/gitlab-ce!15856
Diffstat (limited to 'spec')
-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 129dfa07f15..3c7f578975b 100644
--- a/spec/models/concerns/cache_markdown_field_spec.rb
+++ b/spec/models/concerns/cache_markdown_field_spec.rb
@@ -102,6 +102,26 @@ describe CacheMarkdownField do
it { expect(thing.cached_markdown_version).to eq(CacheMarkdownField::CACHE_VERSION) }
end
+ context 'when a markdown field is set repeatedly to an empty string' do
+ it do
+ expect(thing).to receive(:refresh_markdown_cache).once
+ thing.foo = ''
+ thing.save
+ thing.foo = ''
+ thing.save
+ end
+ end
+
+ context 'when a markdown field is set repeatedly to a string which renders as empty html' do
+ it do
+ expect(thing).to receive(:refresh_markdown_cache).once
+ thing.foo = '[//]: # (This is also a comment.)'
+ thing.save
+ thing.foo = '[//]: # (This is also a comment.)'
+ thing.save
+ end
+ end
+
context 'a non-markdown field changed' do
before do
thing.bar = 'OK'