Commit d6985358 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Add a test for issue sentence generation

parent 2af8ace1
...@@ -42,4 +42,8 @@ module MergeRequestsHelper ...@@ -42,4 +42,8 @@ module MergeRequestsHelper
"Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}" "Branches: #{@merge_request.source_branch} #{separator} #{@merge_request.target_branch}"
end end
end end
def issues_sentence(issues)
issues.map { |i| "##{i.iid}" }.to_sentence
end
end end
...@@ -37,5 +37,5 @@ ...@@ -37,5 +37,5 @@
%i.icon-ok %i.icon-ok
Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'} Accepting this merge request will close #{@closes_issues.size == 1 ? 'issue' : 'issues'}
= succeed '.' do = 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