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/controllers/explore/groups_controller_spec.rb')
-rw-r--r--spec/controllers/explore/groups_controller_spec.rb46
1 files changed, 29 insertions, 17 deletions
diff --git a/spec/controllers/explore/groups_controller_spec.rb b/spec/controllers/explore/groups_controller_spec.rb
index 310fe609cf1..a3bd8102462 100644
--- a/spec/controllers/explore/groups_controller_spec.rb
+++ b/spec/controllers/explore/groups_controller_spec.rb
@@ -9,31 +9,43 @@ RSpec.describe Explore::GroupsController do
sign_in(user)
end
- it 'renders group trees' do
- expect(described_class).to include(GroupTree)
- end
+ shared_examples 'explore groups' do
+ it 'renders group trees' do
+ expect(described_class).to include(GroupTree)
+ end
- it 'includes public projects' do
- member_of_group = create(:group)
- member_of_group.add_developer(user)
- public_group = create(:group, :public)
+ it 'includes public projects' do
+ member_of_group = create(:group)
+ member_of_group.add_developer(user)
+ public_group = create(:group, :public)
- get :index
+ get :index
- expect(assigns(:groups)).to contain_exactly(member_of_group, public_group)
- end
+ expect(assigns(:groups)).to contain_exactly(member_of_group, public_group)
+ end
- context 'restricted visibility level is public' do
- before do
- sign_out(user)
+ context 'restricted visibility level is public' do
+ before do
+ sign_out(user)
- stub_application_setting(restricted_visibility_levels: [Gitlab::VisibilityLevel::PUBLIC])
+ 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
- it 'redirects to login page' do
- get :index
+ it_behaves_like 'explore groups'
- expect(response).to redirect_to new_user_session_path
+ context 'generic_explore_groups flag is disabled' do
+ before do
+ stub_feature_flags(generic_explore_groups: false)
end
+
+ it_behaves_like 'explore groups'
end
end