2019-04-15 06:17:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-13 11:16:30 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-03 23:08:05 -04:00
|
|
|
RSpec.describe Explore::GroupsController do
|
2017-09-13 11:16:30 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
get :index
|
|
|
|
|
|
|
|
expect(assigns(:groups)).to contain_exactly(member_of_group, public_group)
|
|
|
|
end
|
2020-04-15 11:09:17 -04:00
|
|
|
|
|
|
|
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
|
2017-09-13 11:16:30 -04:00
|
|
|
end
|