diff options
Diffstat (limited to 'spec/lib/gitlab/audit/null_author_spec.rb')
-rw-r--r-- | spec/lib/gitlab/audit/null_author_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/gitlab/audit/null_author_spec.rb b/spec/lib/gitlab/audit/null_author_spec.rb index 2045139a5f7..e2f71a34534 100644 --- a/spec/lib/gitlab/audit/null_author_spec.rb +++ b/spec/lib/gitlab/audit/null_author_spec.rb @@ -57,6 +57,15 @@ RSpec.describe Gitlab::Audit::NullAuthor do expect(subject.for(-2, audit_event)).to be_a(Gitlab::Audit::DeployTokenAuthor) expect(subject.for(-2, audit_event)).to have_attributes(id: -2, name: 'Test deploy token') end + + it 'returns DeployKeyAuthor when id equals -3', :aggregate_failures do + allow(audit_event).to receive(:[]).with(:author_name).and_return('Test deploy key') + allow(audit_event).to receive(:details).and_return({}) + allow(audit_event).to receive(:target_type) + + expect(subject.for(-3, audit_event)).to be_a(Gitlab::Audit::DeployKeyAuthor) + expect(subject.for(-3, audit_event)).to have_attributes(id: -3, name: 'Test deploy key') + end end describe '#current_sign_in_ip' do |