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

app_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: 89dce9695224feef41208d6a3380347bdc372793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

require 'spec_helper'

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

  let(:hash_message) { { 'message' => 'Message', 'project_id' => '123' } }
  let(:string_message) { 'Information' }

  it 'logs a hash as a JSON' do
    expect(Gitlab::Json.parse(subject.format_message('INFO', Time.now, nil, hash_message))).to include(hash_message)
  end

  it 'logs a string as a JSON' do
    expect(Gitlab::Json.parse(subject.format_message('INFO', Time.now, nil, string_message))).to include('message' => string_message)
  end
end