http_log_spec.rb 622 B

1234567891011121314151617
  1. require 'rails_helper'
  2. RSpec.describe HttpLog do
  3. let(:subject) { build(:http_log) }
  4. describe 'callbacks' do
  5. # See https://github.com/zammad/zammad/issues/2100
  6. it 'converts request/response message data to UTF-8 before saving' do
  7. subject.request[:content] = 'foo'.force_encoding('ascii-8bit')
  8. subject.response[:content] = 'bar'.force_encoding('ascii-8bit')
  9. expect { subject.save }
  10. .to change { subject.request[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
  11. .and change { subject.response[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
  12. end
  13. end
  14. end