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:
authorDouwe Maan <douwe@gitlab.com>2018-02-23 12:14:14 +0300
committerDouwe Maan <douwe@gitlab.com>2018-02-23 12:14:14 +0300
commitf4bc6ec92e2af0b6cfd64f9ff0ca683bf62820d1 (patch)
tree9e34a9a071d0c0c5900c0ba37927de4590fa23f9 /spec/helpers/groups_helper_spec.rb
parent0a8aebcb550b705ec5987c6f905eaf5c5abb1cc1 (diff)
parent08266ba0a14ec296b51cda6b54d1648985a11adf (diff)
Merge branch 'bvl-external-auth-port' into 'master'
Port `read_cross_project` ability from EE See merge request gitlab-org/gitlab-ce!17208
Diffstat (limited to 'spec/helpers/groups_helper_spec.rb')
-rw-r--r--spec/helpers/groups_helper_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb
index 5f608fe18d9..b48c252acd3 100644
--- a/spec/helpers/groups_helper_spec.rb
+++ b/spec/helpers/groups_helper_spec.rb
@@ -201,4 +201,39 @@ describe GroupsHelper do
end
end
end
+
+ describe '#group_sidebar_links' do
+ let(:group) { create(:group, :public) }
+ let(:user) { create(:user) }
+ before do
+ allow(helper).to receive(:current_user) { user }
+ allow(helper).to receive(:can?) { true }
+ helper.instance_variable_set(:@group, group)
+ end
+
+ it 'returns all the expected links' do
+ links = [
+ :overview, :activity, :issues, :labels, :milestones, :merge_requests,
+ :group_members, :settings
+ ]
+
+ expect(helper.group_sidebar_links).to include(*links)
+ end
+
+ it 'includes settings when the user can admin the group' do
+ expect(helper).to receive(:current_user) { user }
+ expect(helper).to receive(:can?).with(user, :admin_group, group) { false }
+
+ expect(helper.group_sidebar_links).not_to include(:settings)
+ end
+
+ it 'excludes cross project features when the user cannot read cross project' do
+ cross_project_features = [:activity, :issues, :labels, :milestones,
+ :merge_requests]
+
+ expect(helper).to receive(:can?).with(user, :read_cross_project) { false }
+
+ expect(helper.group_sidebar_links).not_to include(*cross_project_features)
+ end
+ end
end