blob: f85b8454113de9cd27ca28d57e19b2f38576cd1b (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Showing analytics' do
before do
sign_in user if user
end
# Using a path that is publicly accessible
subject { visit explore_projects_path }
context 'for unauthenticated users' do
let(:user) { nil }
it 'does not show the Analytics link' do
subject
expect(page).not_to have_link('Analytics')
end
end
context 'for regular users' do
let(:user) { create(:user) }
context 'when instance statistics are publicly available' do
before do
stub_application_setting(instance_statistics_visibility_private: false)
end
it 'shows the analytics link' do
subject
expect(page).to have_link('Analytics')
end
end
context 'when instance statistics are not publicly available' do
before do
stub_application_setting(instance_statistics_visibility_private: true)
end
it 'does not show the analytics link' do
subject
# Skipping this test on EE as there is an EE specifc spec for this functionality
# ee/spec/features/dashboards/analytics_spec.rb
skip if Gitlab.ee?
expect(page).not_to have_link('Analytics')
end
end
end
context 'for admins' do
let(:user) { create(:admin) }
it 'shows the analytics link' do
subject
expect(page).to have_link('Analytics')
end
end
end
|