diff options
author | Hassan Zamani <hsn.zamani@gmail.com> | 2017-05-30 09:06:00 +0300 |
---|---|---|
committer | Markus Koller <markus.koller.ext@siemens.com> | 2018-02-08 15:22:41 +0300 |
commit | 583ef9458c5e5c32a14629f5754bc53ed0ad8a33 (patch) | |
tree | 711012ffe04f5822e55332ef971a37e26748689b /spec/models | |
parent | bfb32b46327576f5b5d4ff3d42198ba4601f1830 (diff) |
Add groups to OpenID Connect claims
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/user_spec.rb | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 18c91d4cffd..264a2b948c9 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1557,14 +1557,37 @@ describe User do describe '#authorized_groups' do let!(:user) { create(:user) } let!(:private_group) { create(:group) } + let!(:child_group) { create(:group, parent: private_group) } + + let!(:project_group) { create(:group) } + let!(:project) { create(:project, group: project_group) } before do private_group.add_user(user, Gitlab::Access::MASTER) + project.add_master(user) end subject { user.authorized_groups } - it { is_expected.to eq([private_group]) } + it { is_expected.to contain_exactly private_group, project_group } + end + + describe '#membership_groups' do + let!(:user) { create(:user) } + let!(:parent_group) { create(:group) } + let!(:child_group) { create(:group, parent: parent_group) } + + before do + parent_group.add_user(user, Gitlab::Access::MASTER) + end + + subject { user.membership_groups } + + if Group.supports_nested_groups? + it { is_expected.to contain_exactly parent_group, child_group } + else + it { is_expected.to contain_exactly parent_group } + end end describe '#authorized_projects', :delete do |