File tree 2 files changed +11
-6
lines changed
app/services/task_service
spec/services/task_service
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,10 @@ def execute
12
12
body = @zip . string
13
13
begin
14
14
response = connection . post { |request | request_parameters ( request , body ) }
15
- if response . success?
16
- nil
17
- else
18
- response . status == 401 ? I18n . t ( 'tasks.export_external_confirm.not_authorized' , account_link : @account_link . name ) : response . body
19
- end
15
+ return nil if response . success?
16
+ return I18n . t ( 'tasks.export_external_confirm.not_authorized' , account_link : @account_link . name ) if response . status == 401
17
+
18
+ ERB ::Util . html_escape ( response . body )
20
19
rescue StandardError => e
21
20
e
22
21
end
Original file line number Diff line number Diff line change 51
51
let ( :status ) { 500 }
52
52
let ( :response ) { 'an error occured' }
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
57
63
context 'when response status is 401' do
You can’t perform that action at this time.
0 commit comments