diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-01-26 14:28:08 +0000 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-06 13:35:35 +0000 |
commit | dc229c076cdc0ef6e7f3f74f6e462c22880ff08c (patch) | |
tree | ec2c979bf3dcb0af71661a7903afd02b2e6f6114 /spec/lib/gitlab/git_access_spec.rb | |
parent | e42a548f1dac02577d0c1731fef508dab68c45a5 (diff) | |
download | gitlab-ce-dc229c076cdc0ef6e7f3f74f6e462c22880ff08c.tar.gz |
Abstracts ProjectMoved and ProjectCreated into a BaseProject
Diffstat (limited to 'spec/lib/gitlab/git_access_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git_access_spec.rb | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/spec/lib/gitlab/git_access_spec.rb b/spec/lib/gitlab/git_access_spec.rb index e6ad35867c0..6bfac67ddae 100644 --- a/spec/lib/gitlab/git_access_spec.rb +++ b/spec/lib/gitlab/git_access_spec.rb @@ -221,7 +221,7 @@ describe Gitlab::GitAccess do it 'enqueues a redirected message' do push_access_check - expect(Gitlab::Checks::ProjectMoved.fetch_redirect_message(user.id, project.id)).not_to be_nil + expect(Gitlab::Checks::ProjectMoved.fetch_message(user.id, project.id)).not_to be_nil end end @@ -335,7 +335,7 @@ describe Gitlab::GitAccess do end end - describe '#check_namespace_existence!' do + describe '#check_namespace_accessibility!' do context 'when project exists' do context 'when user can pull or push' do before do @@ -352,28 +352,16 @@ describe Gitlab::GitAccess do end context 'when project does not exist' do - context 'when namespace does not exist' do - let(:access) { described_class.new(actor, nil, protocol, authentication_abilities: authentication_abilities, redirected_path: redirected_path, target_namespace: nil) } - - it 'blocks push and pull' do - aggregate_failures do - expect { push_access_check }.not_to raise_namespace_not_found - expect { pull_access_check }.not_to raise_namespace_not_found - end - end - end - context 'when namespace exists' do context 'when user is unable to push to namespace' do let(:user2) { create(:user) } let(:access) { described_class.new(actor, nil, protocol, authentication_abilities: authentication_abilities, redirected_path: redirected_path, target_namespace: user2.namespace) } - it 'blocks push' do - expect { push_access_check }.to raise_project_create - end - - it 'does not block pull' do - expect { push_access_check }.to raise_error + it 'blocks push and pull' do + aggregate_failures do + expect { push_access_check }.to raise_not_found + expect { pull_access_check }.to raise_not_found + end end end end @@ -841,10 +829,6 @@ describe Gitlab::GitAccess do raise_error(Gitlab::GitAccess::NotFoundError, Gitlab::GitAccess::ERROR_MESSAGES[:project_not_found]) end - def raise_namespace_not_found - raise_error(Gitlab::GitAccess::NotFoundError, Gitlab::GitAccess::ERROR_MESSAGES[:namespace_not_found]) - end - def build_authentication_abilities [ :read_project, |