diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-06-14 03:46:30 +0300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2019-06-14 03:46:30 +0300 |
commit | 6de8cb7e9cf715e720fab9e7359ddb63c992af3b (patch) | |
tree | db642e4210cdfb6bf125c78ebbf0e883eac276ad /spec/models/user_spec.rb | |
parent | 7808259922906877f866d4b28fcd6994790ad8dd (diff) | |
parent | 7bfc4f999231385f2dc24cbb2d34b09cf5ae96c1 (diff) |
Merge branch 'feature/require-2fa-for-all-entities-in-group' into 'master'
inherit require 2fa for all subgroups and projects
See merge request gitlab-org/gitlab-ce!24965
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d1338e34bb8..c95bbb0b3f5 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -2655,9 +2655,9 @@ describe User do end end - context 'with 2FA requirement on nested parent group', :nested_groups do + context 'with 2FA requirement from expanded groups', :nested_groups do let!(:group1) { create :group, require_two_factor_authentication: true } - let!(:group1a) { create :group, require_two_factor_authentication: false, parent: group1 } + let!(:group1a) { create :group, parent: group1 } before do group1a.add_user(user, GroupMember::OWNER) @@ -2685,6 +2685,27 @@ describe User do end end + context "with 2FA requirement from shared project's group" do + let!(:group1) { create :group, require_two_factor_authentication: true } + let!(:group2) { create :group } + let(:shared_project) { create(:project, namespace: group1) } + + before do + shared_project.project_group_links.create!( + group: group2, + group_access: ProjectGroupLink.default_access + ) + + group2.add_user(user, GroupMember::OWNER) + end + + it 'does not require 2FA' do + user.update_two_factor_requirement + + expect(user.require_two_factor_authentication_from_group).to be false + end + end + context 'without 2FA requirement on groups' do let(:group) { create :group } |