File tree 2 files changed +11
-3
lines changed
app/services/exercise_service
spec/services/exercise_service
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def execute
21
21
if response . success?
22
22
nil
23
23
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 )
25
25
end
26
26
rescue StandardError => e
27
27
e . message
Original file line number Diff line number Diff line change 49
49
50
50
context 'when response status is 500' do
51
51
let ( :status ) { 500 }
52
- let ( :response ) { 'an error occured ' }
52
+ let ( :response ) { 'an error occurred ' }
53
53
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
55
61
end
56
62
63
+
64
+
57
65
context 'when response status is 401' do
58
66
let ( :status ) { 401 }
59
67
let ( :response ) { I18n . t ( 'exercises.export_codeharbor.not_authorized' ) }
You can’t perform that action at this time.
0 commit comments