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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 00:07:39 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 00:07:39 +0300
commit74a89b1221eaf780374bd1d4c5b2ee4a0f488908 (patch)
tree27dbcfdbc4216e9bee04b9be9c974d86744d51ba /spec/lib/gitlab/app_json_logger_spec.rb
parentb0abae12affecc466aeb10889e8a6c000d6f67f5 (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.rb18
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