File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
app/services/exercise_service
spec/services/exercise_service Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def execute
2121 if response . success?
2222 nil
2323 else
24- response . status == 401 ? I18n . t ( 'exercises.export_codeharbor.not_authorized' ) : response . body
24+ response . status == 401 ? I18n . t ( 'exercises.export_codeharbor.not_authorized' ) : ERB :: Util . html_escape ( response . body )
2525 end
2626 rescue StandardError => e
2727 e . message
Original file line number Diff line number Diff line change 4949
5050 context 'when response status is 500' do
5151 let ( :status ) { 500 }
52- let ( :response ) { 'an error occured ' }
52+ let ( :response ) { 'an error occurred ' }
5353
54- it { is_expected . to be response }
54+ it { is_expected . to eql response }
55+
56+ context 'when response contains problematic characters' do
57+ let ( :response ) { 'an <error> occurred' }
58+
59+ it { is_expected . to eql 'an <error> occurred' }
60+ end
5561 end
5662
63+
64+
5765 context 'when response status is 401' do
5866 let ( :status ) { 401 }
5967 let ( :response ) { I18n . t ( 'exercises.export_codeharbor.not_authorized' ) }
You can’t perform that action at this time.
0 commit comments