Welcome to mirror list, hosted at ThFree Co, Russian Federation.

groups_controller_spec.rb « explore « controllers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eccbd7fa14dbd915005fd8ff51e5bc66066b1388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

require 'spec_helper'

describe Explore::GroupsController do
  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

  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