diff --git a/lib/gitlab/audit/ci_runner_token_author.rb b/lib/gitlab/audit/ci_runner_token_author.rb index 5f83725b5a30355852c60cdd01840de4895b6a6e..2ace983688e901832bbe08e3904b433883699b03 100644 --- a/lib/gitlab/audit/ci_runner_token_author.rb +++ b/lib/gitlab/audit/ci_runner_token_author.rb @@ -14,7 +14,7 @@ def initialize(audit_event) token = audit_event.details[:runner_registration_token] name = "Registration token: #{token}" else - raise ArgumentError, 'Runner token missing' + name = "Token not available" end super(id: -1, name: name) diff --git a/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb b/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb index 89664c5708468dec712d9722b2a11e736694893a..6718760e92019a1c303f4d82e167810b61006e72 100644 --- a/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb +++ b/spec/lib/gitlab/audit/ci_runner_token_author_spec.rb @@ -34,8 +34,8 @@ {} end - it 'raises ArgumentError' do - expect { subject }.to raise_error ArgumentError, 'Runner token missing' + it 'returns token not available' do + is_expected.to have_attributes(id: -1, name: 'Token not available') end end end