gitlab-org--gitlab-foss/spec/lib/gitlab/git_access_wiki_spec.rb
Douwe Maan b0bf92140f
Merge branch 'fix-unathorized-cloning' into 'security'
Ensure external users are not able to clone disabled repositories.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/23788

See merge request !2017

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-09 12:27:17 +01:00

29 lines
715 B
Ruby

require 'spec_helper'
describe Gitlab::GitAccessWiki, lib: true do
let(:access) { Gitlab::GitAccessWiki.new(user, project, 'web', authentication_abilities: authentication_abilities) }
let(:project) { create(:project) }
let(:user) { create(:user) }
let(:authentication_abilities) do
[
:read_project,
:download_code,
:push_code
]
end
describe 'push_allowed?' do
before do
create(:protected_branch, name: 'master', project: project)
project.team << [user, :developer]
end
subject { access.check('git-receive-pack', changes) }
it { expect(subject.allowed?).to be_truthy }
end
def changes
['6f6d7e7ed 570e7b2ab refs/heads/master']
end
end