diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 15:42:17 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 15:42:17 +0000 |
commit | 44fdf983bd35328dd577d3d3650d14163ef3e2b6 (patch) | |
tree | 84ff300d056cfbabb5a0fe2a9cbaa80aaeab1cc5 /spec/controllers | |
parent | bc9fa07b26184b5c94808f704db6ea1ac81bf4de (diff) | |
download | gitlab-ce-44fdf983bd35328dd577d3d3650d14163ef3e2b6.tar.gz |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/explore/groups_controller_spec.rb | 14 | ||||
-rw-r--r-- | spec/controllers/explore/projects_controller_spec.rb | 12 | ||||
-rw-r--r-- | spec/controllers/help_controller_spec.rb | 14 |
3 files changed, 40 insertions, 0 deletions
diff --git a/spec/controllers/explore/groups_controller_spec.rb b/spec/controllers/explore/groups_controller_spec.rb index 5a32d8ca0d3..eccbd7fa14d 100644 --- a/spec/controllers/explore/groups_controller_spec.rb +++ b/spec/controllers/explore/groups_controller_spec.rb @@ -22,4 +22,18 @@ describe Explore::GroupsController do expect(assigns(:groups)).to contain_exactly(member_of_group, public_group) end + + context 'restricted visibility level is public' do + before do + sign_out(user) + + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) + end + + it 'redirects to login page' do + get :index + + expect(response).to redirect_to new_user_session_path + end + end end diff --git a/spec/controllers/explore/projects_controller_spec.rb b/spec/controllers/explore/projects_controller_spec.rb index c2cd29eb036..00cc2d5a81c 100644 --- a/spec/controllers/explore/projects_controller_spec.rb +++ b/spec/controllers/explore/projects_controller_spec.rb @@ -171,5 +171,17 @@ describe Explore::ProjectsController do get :index, params: { sort: sorting_param } end end + + context 'restricted visibility level is public' do + before do + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) + end + + it 'redirects to login page' do + get :index + + expect(response).to redirect_to new_user_session_path + end + end end end diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb index e010cac2f73..f03fee8d3ae 100644 --- a/spec/controllers/help_controller_spec.rb +++ b/spec/controllers/help_controller_spec.rb @@ -79,6 +79,20 @@ describe HelpController do expect(assigns[:help_index]).to eq '[protocol-relative](//example.com)' end end + + context 'restricted visibility set to public' do + before do + sign_out(user) + + stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC]) + end + + it 'redirects to sign_in path' do + get :index + + expect(response).to redirect_to(new_user_session_path) + end + end end describe 'GET #show' do |