diff options
author | Felipe Artur <felipefac@gmail.com> | 2018-04-23 13:12:26 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2018-04-23 13:56:38 -0300 |
commit | 2b5ac11591848daaea582034ebd07663d9e40dd0 (patch) | |
tree | 5c9938b44283a49e0d2a3cb1a4a6ed6b1f4dd9b3 /spec/policies | |
parent | 97b83b2a97cae850edcf0ce2515c038a258d03b5 (diff) | |
download | gitlab-ce-2b5ac11591848daaea582034ebd07663d9e40dd0.tar.gz |
Fix users not seeing labels from private groups when being a member of a child project
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/group_policy_spec.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/spec/policies/group_policy_spec.rb b/spec/policies/group_policy_spec.rb index b4d25e06d9a..9b5c290b9f9 100644 --- a/spec/policies/group_policy_spec.rb +++ b/spec/policies/group_policy_spec.rb @@ -7,9 +7,9 @@ describe GroupPolicy do let(:master) { create(:user) } let(:owner) { create(:user) } let(:admin) { create(:admin) } - let(:group) { create(:group) } + let(:group) { create(:group, :private) } - let(:guest_permissions) { [:read_group, :upload_file, :read_namespace] } + let(:guest_permissions) { [:read_label, :read_group, :upload_file, :read_namespace] } let(:reporter_permissions) { [:admin_label] } @@ -50,6 +50,7 @@ describe GroupPolicy do end context 'with no user' do + let(:group) { create(:group, :public) } let(:current_user) { nil } it do @@ -63,6 +64,28 @@ describe GroupPolicy do end end + context 'has projects' do + let(:current_user) { create(:user) } + let(:project) { create(:project, namespace: group) } + + before do + project.add_developer(current_user) + end + + it do + expect_allowed(:read_group, :read_label) + end + + context 'in subgroups', :nested_groups do + let(:subgroup) { create(:group, :private, parent: group) } + let(:project) { create(:project, namespace: subgroup) } + + it do + expect_allowed(:read_group, :read_label) + end + end + end + context 'guests' do let(:current_user) { guest } |