diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-14 00:07:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-14 00:07:39 +0300 |
commit | 74a89b1221eaf780374bd1d4c5b2ee4a0f488908 (patch) | |
tree | 27dbcfdbc4216e9bee04b9be9c974d86744d51ba /spec/lib/gitlab/app_json_logger_spec.rb | |
parent | b0abae12affecc466aeb10889e8a6c000d6f67f5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/app_json_logger_spec.rb')
-rw-r--r-- | spec/lib/gitlab/app_json_logger_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/app_json_logger_spec.rb b/spec/lib/gitlab/app_json_logger_spec.rb new file mode 100644 index 00000000000..22a398f8bca --- /dev/null +++ b/spec/lib/gitlab/app_json_logger_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require 'spec_helper' + +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(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(JSON.parse(subject.format_message('INFO', Time.now, nil, string_message))).to include('message' => string_message) + end +end |