No space required after WIP identifier

Modified changelog
This commit is contained in:
Ted Hogan 2015-11-23 11:36:47 -07:00
parent 36f7b624be
commit 6e6a99061d
3 changed files with 17 additions and 1 deletions

View File

@ -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

View File

@ -239,7 +239,7 @@ class MergeRequest < ActiveRecord::Base
end
def work_in_progress?
!!(title =~ /\A\[?WIP\]?:? /i)
!!(title =~ /\A\[?WIP(\]|:| )/i)
end
def mergeable?

View File

@ -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