Commit 2a1c2c67 authored by Roger Rüttimann's avatar Roger Rüttimann Committed by Roger Meier

add tests for 2fa requirment for all sub-entities members (subgroup and projects)

parent 8bfc3a26
......@@ -625,10 +625,7 @@ describe Group do
group.update!(description: 'foobar')
end
it 'calls #update_two_factor_requirement on each group member' do
other_user = create(:user)
group.add_user(other_user, GroupMember::OWNER)
def expects_other_user_to_require_two_factors
calls = 0
allow_any_instance_of(User).to receive(:update_two_factor_requirement) do
calls += 1
......@@ -638,6 +635,29 @@ describe Group do
expect(calls).to eq 2
end
it 'calls #update_two_factor_requirement on each group member' do
other_user = create(:user)
group.add_user(other_user, GroupMember::OWNER)
expects_other_user_to_require_two_factors
end
it 'calls #update_two_factor_requirement on each subgroup member' do
subgroup = create(:group, :nested, parent: group)
subgroup_user = create(:user)
subgroup.add_user(subgroup_user, GroupMember::OWNER)
expects_other_user_to_require_two_factors
end
it 'calls #update_two_factor_requirement on each child project member' do
project = create(:project, group: group)
project_user = create(:user)
project.add_user(project_user, GroupMember::OWNER)
expects_other_user_to_require_two_factors
end
end
describe '#path_changed_hook' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment