Welcome to mirror list, hosted at ThFree Co, Russian Federation.

json_logger_spec.rb « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 87df20c066b55e326d73e9992880991c0583d6e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::JsonLogger do
  subject { described_class.new('/dev/null') }

  it_behaves_like 'a json logger', {}

  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
end