diff options
author | Nick Thomas <nick@gitlab.com> | 2016-10-06 23:01:42 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2016-10-07 02:54:26 +0100 |
commit | 9920551536bb4f78dffeaaf3a194b92f54c34a47 (patch) | |
tree | dad5b2d5f1b725e66d29d355c5095b6899546427 /spec | |
parent | dd159a750b294ee89cb8a4143284ff9788b639fc (diff) | |
download | gitlab-ce-9920551536bb4f78dffeaaf3a194b92f54c34a47.tar.gz |
Enable CacheMarkdownField for the remaining models
This commit alters views for the following models to use the markdown cache if
present:
* AbuseReport
* Appearance
* ApplicationSetting
* BroadcastMessage
* Group
* Issue
* Label
* MergeRequest
* Milestone
* Project
At the same time, calls to `escape_once` have been moved into the `single_line`
Banzai pipeline, so they can't be missed out by accident and the work is done
at save, rather than render, time.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/broadcast_messages_helper_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/banzai/filter/html_entity_filter_spec.rb | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/spec/helpers/broadcast_messages_helper_spec.rb b/spec/helpers/broadcast_messages_helper_spec.rb index 157cc4665a2..c6e3c5c2368 100644 --- a/spec/helpers/broadcast_messages_helper_spec.rb +++ b/spec/helpers/broadcast_messages_helper_spec.rb @@ -7,7 +7,7 @@ describe BroadcastMessagesHelper do end it 'includes the current message' do - current = double(message: 'Current Message') + current = BroadcastMessage.new(message: 'Current Message') allow(helper).to receive(:broadcast_message_style).and_return(nil) @@ -15,7 +15,7 @@ describe BroadcastMessagesHelper do end it 'includes custom style' do - current = double(message: 'Current Message') + current = BroadcastMessage.new(message: 'Current Message') allow(helper).to receive(:broadcast_message_style).and_return('foo') diff --git a/spec/lib/banzai/filter/html_entity_filter_spec.rb b/spec/lib/banzai/filter/html_entity_filter_spec.rb new file mode 100644 index 00000000000..6dc4a970071 --- /dev/null +++ b/spec/lib/banzai/filter/html_entity_filter_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe Banzai::Filter::HTMLEntityFilter, lib: true do + include FilterSpecHelper + + let(:unescaped) { 'foo <strike attr="foo">&&&</strike>' } + let(:escaped) { 'foo <strike attr="foo">&&&</strike>' } + + it 'converts common entities to their HTML-escaped equivalents' do + output = filter(unescaped) + + expect(output).to eq(escaped) + end +end |