diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 09:07:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-20 09:07:06 +0300 |
commit | dd4c30182c16fe27efbbf4c19594bb292fb4ac48 (patch) | |
tree | 3d2e0235a0ab5333a6a2d4990da409640dd2d26f /spec/policies | |
parent | accf0d7db3d58a62212125703df39e341d327ec6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/merge_request_policy_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/policies/merge_request_policy_spec.rb b/spec/policies/merge_request_policy_spec.rb index c21e1244402..285f52956eb 100644 --- a/spec/policies/merge_request_policy_spec.rb +++ b/spec/policies/merge_request_policy_spec.rb @@ -462,6 +462,37 @@ RSpec.describe MergeRequestPolicy do end end + context 'when enabling generate diff summary permission' do + let_it_be(:project) { create(:project) } + let_it_be(:mr) { create(:merge_request, target_project: project, source_project: project) } + let_it_be(:user) { create(:user) } + let(:policy) { permissions(user, mr) } + + context 'when can read_merge_request' do + before do + project.add_developer(user) + end + + it 'allows to generate_diff_summary' do + expect(policy).to be_allowed(:generate_diff_summary) + end + end + + context 'when can not read_merge_request' do + it 'does not allow to generate_diff_summary' do + expect(policy).not_to be_allowed(:generate_diff_summary) + end + + context 'and when is the LLM bot' do + let(:user) { create(:user, :llm_bot) } + + it 'allows to generate_diff_summary' do + expect(policy).to be_allowed(:generate_diff_summary) + end + end + end + end + context 'when the author of the merge request is banned', feature_category: :insider_threat do let_it_be(:user) { create(:user) } let_it_be(:admin) { create(:user, :admin) } |