Commit 55d4e264 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ce_issues_sentence' into 'master'

Issues sentence helper

This will make merging CE into EE later easier.
parents 87fd342a d6985358
......@@ -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))
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment