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/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