Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-24 12:09:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-24 12:09:44 +0300
commitb1b7c2f9a744197a111c81719c546a474adab4e8 (patch)
tree2fe9d392110fb1fee8a8e6eac1f520425fee1c9c /spec/helpers
parent81c305759174e2f55176356e98d264ea1c4b747d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/groups_helper_spec.rb27
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