diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-24 12:09:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-24 12:09:44 +0300 |
commit | b1b7c2f9a744197a111c81719c546a474adab4e8 (patch) | |
tree | 2fe9d392110fb1fee8a8e6eac1f520425fee1c9c /spec/helpers | |
parent | 81c305759174e2f55176356e98d264ea1c4b747d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/groups_helper_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb index ac2f028f937..5be247c5b49 100644 --- a/spec/helpers/groups_helper_spec.rb +++ b/spec/helpers/groups_helper_spec.rb @@ -340,4 +340,31 @@ describe GroupsHelper do end end end + + describe '#can_update_default_branch_protection?' do + let(:current_user) { create(:user) } + let(:group) { create(:group) } + + subject { helper.can_update_default_branch_protection?(group) } + + before do + allow(helper).to receive(:current_user) { current_user } + end + + context 'for users who can update default branch protection of the group' do + before do + allow(helper).to receive(:can?).with(current_user, :update_default_branch_protection, group) { true } + end + + it { is_expected.to be_truthy } + end + + context 'for users who cannot update default branch protection of the group' do + before do + allow(helper).to receive(:can?).with(current_user, :update_default_branch_protection, group) { false } + end + + it { is_expected.to be_falsey } + end + end end |