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:
Diffstat (limited to 'spec/lib/gitlab/git_audit_event_spec.rb')
-rw-r--r--spec/lib/gitlab/git_audit_event_spec.rb79
1 files changed, 0 insertions, 79 deletions
diff --git a/spec/lib/gitlab/git_audit_event_spec.rb b/spec/lib/gitlab/git_audit_event_spec.rb
deleted file mode 100644
index c533b39f550..00000000000
--- a/spec/lib/gitlab/git_audit_event_spec.rb
+++ /dev/null
@@ -1,79 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-
-RSpec.describe Gitlab::GitAuditEvent, feature_category: :source_code_management do
- let_it_be(:player) { create(:user) }
- let_it_be(:group) { create(:group, :public) }
- let_it_be(:project) { create(:project) }
-
- subject { described_class.new(player, project) }
-
- describe '#send_audit_event' do
- let(:msg) { 'valid_msg' }
-
- context 'with successfully sending' do
- let_it_be(:project) { create(:project, namespace: group) }
-
- before do
- allow(::Gitlab::Audit::Auditor).to receive(:audit)
- end
-
- context 'when player is a regular user' do
- it 'sends git audit event' do
- expect(::Gitlab::Audit::Auditor).to receive(:audit).with(a_hash_including(
- name: 'repository_git_operation',
- stream_only: true,
- author: player,
- scope: project,
- target: project,
- message: msg
- )).once
-
- subject.send_audit_event(msg)
- end
- end
-
- context 'when player is ::API::Support::GitAccessActor' do
- let_it_be(:user) { player }
- let_it_be(:key) { create(:key, user: user) }
- let_it_be(:git_access_actor) { ::API::Support::GitAccessActor.new(user: user, key: key) }
-
- subject { described_class.new(git_access_actor, project) }
-
- it 'sends git audit event' do
- expect(::Gitlab::Audit::Auditor).to receive(:audit).with(a_hash_including(
- name: 'repository_git_operation',
- stream_only: true,
- author: git_access_actor.deploy_key_or_user,
- scope: project,
- target: project,
- message: msg
- )).once
-
- subject.send_audit_event(msg)
- end
- end
- end
-
- context 'when user is blank' do
- let_it_be(:player) { nil }
-
- it 'does not send git audit event' do
- expect(::Gitlab::Audit::Auditor).not_to receive(:audit)
-
- subject.send_audit_event(msg)
- end
- end
-
- context 'when project is blank' do
- let_it_be(:project) { nil }
-
- it 'does not send git audit event' do
- expect(::Gitlab::Audit::Auditor).not_to receive(:audit)
-
- subject.send_audit_event(msg)
- end
- end
- end
-end