expect{subject.validate!}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to force push code to a protected branch on this project.')
end
it'raises an error if the user is not allowed to merge to protected branches'do
expect{subject.validate!}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to merge code into protected branches on this project.')
end
it'raises an error if the user is not allowed to push to protected branches'do
expect{subject.validate!}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to push code to protected branches on this project.')
expect{subject.validate!}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You can only use an existing protected branch ref as the basis of a new protected branch.')
expect{subject.validate!}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You can only create protected branches using the web interface and API.')
context'if the user is not allowed to delete protected branches'do
it'raises an error'do
expect{subject.validate!}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to delete protected branches from this project. Only a project maintainer or owner can delete a protected branch.')
end
end
context'if the user is allowed to delete protected branches'do
beforedo
project.add_maintainer(user)
end
context'through the web interface'do
let(:protocol){'web'}
it'allows branch deletion'do
expect{subject.validate!}.not_toraise_error
end
end
context'over SSH or HTTP'do
it'raises an error'do
expect{subject.validate!}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You can only delete protected branches using the web interface.')