Sha256: 0c34ca0d1201b854ef93702646d43dc6b7fb2552549465d79152e5d1962f0aae

Contents?: true

Size: 555 Bytes

Versions: 12

Compression:

Stored size: 555 Bytes

Contents

require 'spec_helper'

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

    context 'when 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

12 entries across 12 versions & 1 rubygems

Version Path
loga-2.8.0 spec/unit/loga/event_spec.rb
loga-2.7.0 spec/unit/loga/event_spec.rb
loga-2.6.1 spec/unit/loga/event_spec.rb
loga-2.6.0 spec/unit/loga/event_spec.rb
loga-2.5.4 spec/unit/loga/event_spec.rb
loga-2.5.3 spec/unit/loga/event_spec.rb
loga-2.5.2 spec/unit/loga/event_spec.rb
loga-2.5.1 spec/unit/loga/event_spec.rb
loga-2.5.0 spec/unit/loga/event_spec.rb
loga-2.4.0 spec/unit/loga/event_spec.rb
loga-2.3.1 spec/unit/loga/event_spec.rb
loga-2.3.0 spec/unit/loga/event_spec.rb