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>2023-05-13 06:06:53 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-13 06:06:53 +0300
commitc0b9c14ebd1524a1e2334e656f997ec680a18966 (patch)
tree4437aea2c4239279131a56adca1679f636683d29 /spec/policies
parent98638cd5e43611aac2193a5c2f80f72374040430 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-rw-r--r--spec/policies/concerns/policy_actor_spec.rb18
-rw-r--r--spec/policies/global_policy_spec.rb7
2 files changed, 24 insertions, 1 deletions
diff --git a/spec/policies/concerns/policy_actor_spec.rb b/spec/policies/concerns/policy_actor_spec.rb
index 7271cbb4a9d..7fd9db67032 100644
--- a/spec/policies/concerns/policy_actor_spec.rb
+++ b/spec/policies/concerns/policy_actor_spec.rb
@@ -2,7 +2,17 @@
require 'spec_helper'
-RSpec.describe PolicyActor do
+RSpec.describe PolicyActor, feature_category: :shared do
+ let(:policy_actor_test_class) do
+ Class.new do
+ include PolicyActor
+ end
+ end
+
+ before do
+ stub_const('PolicyActorTestClass', policy_actor_test_class)
+ end
+
it 'implements all the methods from user' do
methods = subject.instance_methods
@@ -10,4 +20,10 @@ RSpec.describe PolicyActor do
# initialized. So here we just use an instance
expect(build(:user).methods).to include(*methods)
end
+
+ describe '#security_policy_bot?' do
+ subject { PolicyActorTestClass.new.security_policy_bot? }
+
+ it { is_expected.to eq(false) }
+ end
end
diff --git a/spec/policies/global_policy_spec.rb b/spec/policies/global_policy_spec.rb
index 0d91c288bbc..dce97fab252 100644
--- a/spec/policies/global_policy_spec.rb
+++ b/spec/policies/global_policy_spec.rb
@@ -10,6 +10,7 @@ RSpec.describe GlobalPolicy, feature_category: :shared do
let_it_be(:service_account) { create(:user, :service_account) }
let_it_be(:migration_bot) { create(:user, :migration_bot) }
let_it_be(:security_bot) { create(:user, :security_bot) }
+ let_it_be(:security_policy_bot) { create(:user, :security_policy_bot) }
let_it_be(:llm_bot) { create(:user, :llm_bot) }
let_it_be_with_reload(:current_user) { create(:user) }
let_it_be(:user) { create(:user) }
@@ -410,6 +411,12 @@ RSpec.describe GlobalPolicy, feature_category: :shared do
it { is_expected.to be_allowed(:access_git) }
end
+ context 'security policy bot' do
+ let(:current_user) { security_policy_bot }
+
+ it { is_expected.to be_allowed(:access_git) }
+ end
+
describe 'deactivated user' do
before do
current_user.deactivate