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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-20 21:42:06 +0300
commit6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch)
tree78be5963ec075d80116a932011d695dd33910b4e /spec/lib/gitlab/audit
parent1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff)
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/lib/gitlab/audit')
-rw-r--r--spec/lib/gitlab/audit/null_author_spec.rb22
-rw-r--r--spec/lib/gitlab/audit/unauthenticated_author_spec.rb17
2 files changed, 39 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
diff --git a/spec/lib/gitlab/audit/unauthenticated_author_spec.rb b/spec/lib/gitlab/audit/unauthenticated_author_spec.rb
new file mode 100644
index 00000000000..4e5c477fc2a
--- /dev/null
+++ b/spec/lib/gitlab/audit/unauthenticated_author_spec.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Audit::UnauthenticatedAuthor do
+ describe '#initialize' do
+ it 'sets correct attributes' do
+ expect(described_class.new(name: 'Peppa Pig'))
+ .to have_attributes(id: -1, name: 'Peppa Pig')
+ end
+
+ it 'sets default name when it is not provided' do
+ expect(described_class.new)
+ .to have_attributes(id: -1, name: 'An unauthenticated user')
+ end
+ end
+end