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/audit/null_author_spec.rb')
-rw-r--r--spec/lib/gitlab/audit/null_author_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/audit/null_author_spec.rb b/spec/lib/gitlab/audit/null_author_spec.rb
new file mode 100644
index 00000000000..eb80e5faa89
--- /dev/null
+++ b/spec/lib/gitlab/audit/null_author_spec.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Audit::NullAuthor do
+ subject { described_class }
+
+ describe '.for' do
+ it 'returns an DeletedAuthor' do
+ expect(subject.for(666, 'Old Hat')).to be_a(Gitlab::Audit::DeletedAuthor)
+ end
+
+ it 'returns an UnauthenticatedAuthor when id equals -1', :aggregate_failures do
+ expect(subject.for(-1, 'Frank')).to be_a(Gitlab::Audit::UnauthenticatedAuthor)
+ expect(subject.for(-1, 'Frank')).to have_attributes(id: -1, name: 'Frank')
+ end
+ end
+
+ describe '#current_sign_in_ip' do
+ it { expect(subject.new(id: 888, name: 'Guest').current_sign_in_ip).to be_nil }
+ end
+end