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>2022-11-17 14:33:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-17 14:33:21 +0300
commit7021455bd1ed7b125c55eb1b33c5a01f2bc55ee0 (patch)
tree5bdc2229f5198d516781f8d24eace62fc7e589e9 /spec/requests/search_controller_spec.rb
parent185b095e93520f96e9cfc31d9c3e69b498cdab7c (diff)
Add latest changes from gitlab-org/gitlab@15-6-stable-eev15.6.0-rc42
Diffstat (limited to 'spec/requests/search_controller_spec.rb')
-rw-r--r--spec/requests/search_controller_spec.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/spec/requests/search_controller_spec.rb b/spec/requests/search_controller_spec.rb
index 93a2fecab74..613732c19ea 100644
--- a/spec/requests/search_controller_spec.rb
+++ b/spec/requests/search_controller_spec.rb
@@ -103,13 +103,17 @@ RSpec.describe SearchController, type: :request do
expect(response).not_to redirect_to(project_commit_path(project, sha))
end
- it 'does not redirect if user cannot download_code from project' do
- allow(Ability).to receive(:allowed?).and_call_original
- allow(Ability).to receive(:allowed?).with(user, :download_code, project).and_return(false)
+ context 'when user cannot read_code' do
+ before do
+ allow(Ability).to receive(:allowed?).and_call_original
+ allow(Ability).to receive(:allowed?).with(user, :read_code, project).and_return(false)
+ end
- send_search_request({ search: sha, project_id: project.id })
+ it 'does not redirect' do
+ send_search_request({ search: sha, project_id: project.id })
- expect(response).not_to redirect_to(project_commit_path(project, sha))
+ expect(response).not_to redirect_to(project_commit_path(project, sha))
+ end
end
it 'does not redirect if commit sha not found in project' do