From 2b73aaa15ad9f651f51f8c71de461da6664a4fbb Mon Sep 17 00:00:00 2001 From: Ali Ibrahim Date: Sun, 14 Aug 2016 13:49:08 -0400 Subject: Allow to add deploy keys with write-access --- spec/lib/gitlab/git_access_spec.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index f12c9a370f7..d0e73d70e6e 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -284,19 +284,22 @@ describe Gitlab::GitAccess, lib: true do end describe 'deploy key permissions' do - let(:key) { create(:deploy_key) } - let(:actor) { key } - context 'push code' do subject { access.check('git-receive-pack', '_any') } context 'when project is authorized' do + let(:key) { create(:deploy_key, can_push: true) } + let(:actor) { key } + before { key.projects << project } - it { expect(subject).not_to be_allowed } + it { expect(subject).to be_allowed } end context 'when unauthorized' do + let(:key) { create(:deploy_key, can_push: false) } + let(:actor) { key } + context 'to public project' do let(:project) { create(:project, :public) } -- cgit v1.2.1