Sha256: 37c3acfa20b6fe501e590d936c892ed16381821f1bc52e7e58f781765d9f40c1

Contents?: true

Size: 545 Bytes

Versions: 4

Compression:

Stored size: 545 Bytes

Contents

require 'spec_helper'

RSpec.describe Loga::Event, timecop: true do
  describe 'initialize' do
    context 'no message is passed' do
      it 'sets message to an empty string' do
        expect(subject.message).to eq ''
      end
    end

    context 'message is passed' do
      let(:message) { "stuff \xC2".force_encoding 'ASCII-8BIT' }
      let(:subject) { described_class.new message: message }

      it 'sanitizes the input to be UTF-8 convertable' do
        expect(subject.message.to_json).to eq '"stuff ?"'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
loga-2.2.0 spec/unit/loga/event_spec.rb
loga-2.1.2 spec/unit/loga/event_spec.rb
loga-2.1.1 spec/unit/loga/event_spec.rb
loga-2.1.0 spec/unit/loga/event_spec.rb