Merge branch 'ce_issues_sentence' into 'master'

Issues sentence helper

This will make merging CE into EE later easier.
This commit is contained in:
Dmitriy Zaporozhets 2014-06-14 09:39:19 +00:00
commit 55d4e2647d
3 changed files with 17 additions and 1 deletions

View file

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

View file

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

View 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