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>2023-05-23 15:10:24 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-23 15:10:24 +0300
commite6d048d769240760008f0dbb6b811e1ebc675292 (patch)
treee005f05e66518044c7e8bc33e263f12f2561708d /spec/helpers
parent611b009e924c25fcc8706b52af90542c4b78f0c0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/safe_format_helper_spec.rb25
1 files changed, 16 insertions, 9 deletions
diff --git a/spec/helpers/safe_format_helper_spec.rb b/spec/helpers/safe_format_helper_spec.rb
index 33c4c86ecc8..3639494060d 100644
--- a/spec/helpers/safe_format_helper_spec.rb
+++ b/spec/helpers/safe_format_helper_spec.rb
@@ -27,15 +27,8 @@ RSpec.describe SafeFormatHelper, feature_category: :shared do
result: '<b>strong</b> &lt;a href=&quot;&quot;&gt;link&lt;/a&gt;'
context 'when format is marked as html_safe' do
- let(:format) { '<b>strong</b>'.html_safe }
- let(:args) { {} }
-
- it 'raises an error' do
- message = 'Argument `format` must not be marked as html_safe!'
-
- expect { helper.safe_format(format, **args) }
- .to raise_error ArgumentError, message
- end
+ it_behaves_like 'safe formatting', '<b>strong</b>'.html_safe, args: {},
+ result: '&lt;b&gt;strong&lt;/b&gt;'
end
context 'with a view component' do
@@ -54,5 +47,19 @@ RSpec.describe SafeFormatHelper, feature_category: :shared do
.to eq('&lt;b&gt;&lt;br&gt;&lt;/b&gt;')
end
end
+
+ context 'with format containing escaped entities' do
+ it_behaves_like 'safe formatting', 'In &lt; hour',
+ args: {},
+ result: 'In &lt; hour'
+
+ it_behaves_like 'safe formatting', '&quot;air&quot;',
+ args: {},
+ result: '&quot;air&quot;'
+
+ it_behaves_like 'safe formatting', 'Mix & match &gt; all',
+ args: {},
+ result: 'Mix &amp; match &gt; all'
+ end
end
end