Commit 42c631b1 authored by Patrick Bajao's avatar Patrick Bajao

Remove protected_branch_creation feature flag

parent 10bf3bbc
......@@ -48,7 +48,7 @@ module Gitlab
if project.empty_repo?
protected_branch_push_checks
elsif creation? && protected_branch_creation_enabled?
elsif creation?
protected_branch_creation_checks
elsif deletion?
protected_branch_deletion_checks
......@@ -124,10 +124,6 @@ module Gitlab
Gitlab::Routing.url_helpers.project_project_members_url(project)
end
def protected_branch_creation_enabled?
Feature.enabled?(:protected_branch_creation, project, default_enabled: true)
end
def matching_merge_request?
Checks::MatchingMergeRequest.new(newrev, branch_name, project).match?
end
......
......@@ -77,37 +77,6 @@ describe Gitlab::Checks::BranchCheck do
let(:oldrev) { '0000000000000000000000000000000000000000' }
let(:ref) { 'refs/heads/feature' }
context 'protected branch creation feature is disabled' do
before do
stub_feature_flags(protected_branch_creation: false)
end
context 'user is not allowed to push to protected branch' do
before do
allow(user_access)
.to receive(:can_push_to_branch?)
.and_return(false)
end
it 'raises an error' do
expect { subject.validate! }.to raise_error(Gitlab::GitAccess::UnauthorizedError, 'You are not allowed to push code to protected branches on this project.')
end
end
context 'user is allowed to push to protected branch' do
before do
allow(user_access)
.to receive(:can_push_to_branch?)
.and_return(true)
end
it 'does not raise an error' do
expect { subject.validate! }.not_to raise_error
end
end
end
context 'protected branch creation feature is enabled' do
context 'user can push to branch' do
before do
allow(user_access)
......@@ -193,7 +162,6 @@ describe Gitlab::Checks::BranchCheck do
end
end
end
end
context 'branch deletion' do
let(:newrev) { '0000000000000000000000000000000000000000' }
......
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