diff options
author | Andreas Kämmerle <andreas.kaemmerle@gmail.com> | 2018-09-13 12:00:59 +0200 |
---|---|---|
committer | Andreas Kämmerle <andreas.kaemmerle@gmail.com> | 2018-09-13 12:00:59 +0200 |
commit | 87d01cc3bfc12c08024881dc8f13101e5430e3e6 (patch) | |
tree | 05e82defa51500257f97e3530862da03668895e3 /spec/models/service_spec.rb | |
parent | fef5c923c009c64183cc43909444a1bdaba218b7 (diff) | |
parent | 71f3d48544cc0857c8d470b182f7e809de6a4642 (diff) | |
download | gitlab-ce-consolidate-page-widths-part02.tar.gz |
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into consolidate-page-widths-part02consolidate-page-widths-part02
Diffstat (limited to 'spec/models/service_spec.rb')
-rw-r--r-- | spec/models/service_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index 029ad7f3e9f..25eecb3f909 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -345,4 +345,31 @@ describe Service do expect(service.api_field_names).to eq(['safe_field']) end end + + context 'logging' do + let(:project) { create(:project) } + let(:service) { create(:service, project: project) } + let(:test_message) { "test message" } + let(:arguments) do + { + service_class: service.class.name, + project_path: project.full_path, + project_id: project.id, + message: test_message, + additional_argument: 'some argument' + } + end + + it 'logs info messages using json logger' do + expect(Gitlab::JsonLogger).to receive(:info).with(arguments) + + service.log_info(test_message, additional_argument: 'some argument') + end + + it 'logs error messages using json logger' do + expect(Gitlab::JsonLogger).to receive(:error).with(arguments) + + service.log_error(test_message, additional_argument: 'some argument') + end + end end |