2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::JsonLogger do
|
2018-11-18 11:00:15 +05:30
|
|
|
subject { described_class.new('/dev/null') }
|
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
it_behaves_like 'a json logger', {}
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2023-01-13 00:05:48 +05:30
|
|
|
describe '#file_name' do
|
|
|
|
let(:subclass) do
|
|
|
|
Class.new(Gitlab::JsonLogger) do
|
|
|
|
def self.file_name_noext
|
|
|
|
'testlogger'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'raises error when file_name_noext not implemented' do
|
|
|
|
expect { described_class.file_name }.to raise_error(
|
|
|
|
'JsonLogger implementations must provide file_name_noext implementation'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns log file name when file_name_noext is implemented' do
|
|
|
|
expect(subclass.file_name).to eq('testlogger.log')
|
|
|
|
end
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|