diff options
author | Mark Chao <mchao@gitlab.com> | 2018-06-07 23:56:59 +0900 |
---|---|---|
committer | Mark Chao <mchao@gitlab.com> | 2018-06-20 23:27:17 +0800 |
commit | 5b994b8199a3679b6f5ef0d00edce22ea9662664 (patch) | |
tree | 6574c99eb3b963d0518e079f041552bb10367756 /spec/presenters | |
parent | 222284a6bf9348b30b5ce2b1b04370163e2120e5 (diff) | |
download | gitlab-ce-5b994b8199a3679b6f5ef0d00edce22ea9662664.tar.gz |
Notify only when unmergeable due to conflict
There is still the edge case when 'no commits' changes to 'conflict'
would not trigger notification, which we ignore for now.
Calling can_be_merged? can cause exception (e.g. non-UTF8)
Ignore those by rescueing.
Remove unmergeable_reason as now only conflict is notified
Update spec
Diffstat (limited to 'spec/presenters')
-rw-r--r-- | spec/presenters/merge_request_presenter_spec.rb | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/spec/presenters/merge_request_presenter_spec.rb b/spec/presenters/merge_request_presenter_spec.rb index d5fb4a7742c..e3b37739e8e 100644 --- a/spec/presenters/merge_request_presenter_spec.rb +++ b/spec/presenters/merge_request_presenter_spec.rb @@ -70,41 +70,6 @@ describe MergeRequestPresenter do end end - describe "#unmergeable_reasons" do - let(:presenter) { described_class.new(resource, current_user: user) } - - before do - # Mergeable base state - allow(resource).to receive(:has_no_commits?).and_return(false) - allow(resource).to receive(:source_branch_exists?).and_return(true) - allow(resource).to receive(:target_branch_exists?).and_return(true) - allow(resource.project.repository).to receive(:can_be_merged?).and_return(true) - end - - it "handles mergeable request" do - expect(presenter.unmergeable_reasons).to eq([]) - end - - it "handles no commit" do - allow(resource).to receive(:has_no_commits?).and_return(true) - - expect(presenter.unmergeable_reasons).to eq(["no commits"]) - end - - it "handles branches missing" do - allow(resource).to receive(:source_branch_exists?).and_return(false) - allow(resource).to receive(:target_branch_exists?).and_return(false) - - expect(presenter.unmergeable_reasons).to eq(["source branch is missing", "target branch is missing"]) - end - - it "handles merge conflict" do - allow(resource.project.repository).to receive(:can_be_merged?).and_return(false) - - expect(presenter.unmergeable_reasons).to eq(["has merge conflicts"]) - end - end - describe '#conflict_resolution_path' do let(:project) { create :project } let(:user) { create :user } |