diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-23 15:10:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-23 15:10:24 +0300 |
commit | e6d048d769240760008f0dbb6b811e1ebc675292 (patch) | |
tree | e005f05e66518044c7e8bc33e263f12f2561708d /spec/helpers | |
parent | 611b009e924c25fcc8706b52af90542c4b78f0c0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/safe_format_helper_spec.rb | 25 |
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> <a href="">link</a>' 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: '<b>strong</b>' end context 'with a view component' do @@ -54,5 +47,19 @@ RSpec.describe SafeFormatHelper, feature_category: :shared do .to eq('<b><br></b>') end end + + context 'with format containing escaped entities' do + it_behaves_like 'safe formatting', 'In < hour', + args: {}, + result: 'In < hour' + + it_behaves_like 'safe formatting', '"air"', + args: {}, + result: '"air"' + + it_behaves_like 'safe formatting', 'Mix & match > all', + args: {}, + result: 'Mix & match > all' + end end end |