Merge branch 'ce_issues_sentence' into 'master'
Issues sentence helper This will make merging CE into EE later easier.
This commit is contained in:
commit
55d4e2647d
3 changed files with 17 additions and 1 deletions
|
@ -42,4 +42,8 @@ module MergeRequestsHelper
|
|||
"Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}"
|
||||
end
|
||||
end
|
||||
|
||||
def issues_sentence(issues)
|
||||
issues.map { |i| "##{i.iid}" }.to_sentence
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,5 +37,5 @@
|
|||
%i.icon-ok
|
||||
Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'}
|
||||
= succeed '.' do
|
||||
!= gfm(@closes_issues.map { |i| "##{i.iid}" }.to_sentence)
|
||||
!= gfm(issues_sentence(@closes_issues))
|
||||
|
||||
|
|
12
spec/helpers/merge_requests_helper.rb
Normal file
12
spec/helpers/merge_requests_helper.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe MergeRequestsHelper do
|
||||
describe :issues_sentence do
|
||||
subject { issues_sentence(issues) }
|
||||
let(:issues) do
|
||||
[build(:issue, iid: 1), build(:issue, iid: 2), build(:issue, iid: 3)]
|
||||
end
|
||||
|
||||
it { should eq('#1, #2, and #3') }
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue