From f549b01a04549e016aa5de28b6a43daa74283743 Mon Sep 17 00:00:00 2001 From: Nick Thomas <nick@gitlab.com> Date: Wed, 7 Jun 2017 15:44:17 +0100 Subject: [PATCH] Fix conflicts in Gitlab::GitAccessWiki and specs --- lib/gitlab/git_access_wiki.rb | 12 ++++-------- spec/lib/gitlab/git_access_wiki_spec.rb | 9 ++------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/lib/gitlab/git_access_wiki.rb b/lib/gitlab/git_access_wiki.rb index c14434d14f5..58d85e32d6d 100644 --- a/lib/gitlab/git_access_wiki.rb +++ b/lib/gitlab/git_access_wiki.rb @@ -1,6 +1,7 @@ module Gitlab class GitAccessWiki < GitAccess ERROR_MESSAGES = { + geo: "You can't push code to a secondary GitLab Geo node.", write_to_wiki: "You are not allowed to write to this project's wiki." }.freeze @@ -13,17 +14,12 @@ module Gitlab end def check_single_change_access(change) -<<<<<<< HEAD if Gitlab::Geo.enabled? && Gitlab::Geo.secondary? - build_status_object(false, "You can't push code to a secondary GitLab Geo node.") - elsif user_access.can_do_action?(:create_wiki) - build_status_object(true) - else - build_status_object(false, "You are not allowed to write to this project's wiki.") -======= + raise UnauthorizedError, ERROR_MESSAGES[:geo] + end + unless user_access.can_do_action?(:create_wiki) raise UnauthorizedError, ERROR_MESSAGES[:write_to_wiki] ->>>>>>> ce/master end true diff --git a/spec/lib/gitlab/git_access_wiki_spec.rb b/spec/lib/gitlab/git_access_wiki_spec.rb index 45a1eff2969..d8ecde99422 100644 --- a/spec/lib/gitlab/git_access_wiki_spec.rb +++ b/spec/lib/gitlab/git_access_wiki_spec.rb @@ -22,20 +22,15 @@ describe Gitlab::GitAccessWiki, lib: true do subject { access.check('git-receive-pack', changes) } -<<<<<<< HEAD - it { expect(subject.allowed?).to be_truthy } + it { expect { subject }.not_to raise_error } context 'when in a secondary gitlab geo node' do before do allow(Gitlab::Geo).to receive(:enabled?) { true } allow(Gitlab::Geo).to receive(:secondary?) { true } end -======= - it { expect { subject }.not_to raise_error } - end ->>>>>>> ce/master - it { expect(subject.allowed?).to be_falsey } + it { expect { subject }.to raise_error(Gitlab::GitAccess::UnauthorizedError, "You can't push code to a secondary GitLab Geo node.") } end end end -- 2.30.9