diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/merge_request.rb | 2 | ||||
-rw-r--r-- | spec/models/merge_request_spec.rb | 15 |
3 files changed, 17 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG index fc7b6e75b1d..2453b35ead3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 8.3.0 (unreleased) - Fix: Assignee selector is empty when 'Unassigned' is selected (Jose Corcuera) + - WIP identifier on merge requests no longer requires trailing space v 8.2.0 - Improved performance of finding projects and groups in various places diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 1b3d6079d2c..2b336ca8927 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -239,7 +239,7 @@ class MergeRequest < ActiveRecord::Base end def work_in_progress? - !!(title =~ /\A\[?WIP\]?:? /i) + !!(title =~ /\A\[?WIP(\]|:| )/i) end def mergeable? diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 567c911425c..edf211c85c1 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -162,6 +162,21 @@ describe MergeRequest do expect(subject).to be_work_in_progress end + it "detects the 'WIP' prefix" do + subject.title = "WIP#{subject.title}" + expect(subject).to be_work_in_progress + end + + it "detects the 'WIP:' prefix" do + subject.title = "WIP:#{subject.title}" + expect(subject).to be_work_in_progress + end + + it "detects the '[WIP]' prefix" do + subject.title = "[WIP]#{subject.title}" + expect(subject).to be_work_in_progress + end + it "doesn't detect WIP for words starting with WIP" do subject.title = "Wipwap #{subject.title}" expect(subject).not_to be_work_in_progress |