debian-mirror-gitlab/spec/lib/gitlab/app_text_logger_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
742 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::AppTextLogger do
2020-03-13 15:44:24 +05:30
subject { described_class.new('/dev/null') }
let(:hash_message) { { message: 'Message', project_id: 123 } }
let(:string_message) { 'Information' }
it 'logs a hash as string' do
expect(subject.format_message('INFO', Time.now, nil, hash_message )).to include(hash_message.to_s)
end
it 'logs a string unchanged' do
expect(subject.format_message('INFO', Time.now, nil, string_message)).to include(string_message)
end
it 'logs time in UTC with ISO8601.3 standard' do
2020-11-24 15:15:51 +05:30
freeze_time do
2020-03-13 15:44:24 +05:30
expect(subject.format_message('INFO', Time.now, nil, string_message))
.to include(Time.now.utc.iso8601(3))
end
end
end