diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-04-26 09:40:12 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-04-26 09:40:12 +0000 |
commit | 3ff8d8020e495df319f0b0921bc94b1c3470f6f0 (patch) | |
tree | 088b1e58e8eba3aad4ee45e19993897eb2cf5b4f /spec/helpers | |
parent | f2da2df43a6901061a7e6b861c79025644d3b469 (diff) | |
parent | a78eeefd6e76c956751a2a7f03efeaee28f83b46 (diff) | |
download | gitlab-ce-3ff8d8020e495df319f0b0921bc94b1c3470f6f0.tar.gz |
Merge branch '20378-natural-sort-issue-numbers' into 'master'
Change issues sentence to use natural sorting
Closes #20378
See merge request !7110
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/merge_requests_helper_spec.rb | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/spec/helpers/merge_requests_helper_spec.rb b/spec/helpers/merge_requests_helper_spec.rb index 25f23826648..e9037749ef2 100644 --- a/spec/helpers/merge_requests_helper_spec.rb +++ b/spec/helpers/merge_requests_helper_spec.rb @@ -22,24 +22,51 @@ describe MergeRequestsHelper do end describe '#issues_sentence' do + let(:project) { create :project } + subject { issues_sentence(issues) } let(:issues) do - [build(:issue, iid: 1), build(:issue, iid: 2), build(:issue, iid: 3)] + [build(:issue, iid: 2, project: project), + build(:issue, iid: 3, project: project), + build(:issue, iid: 1, project: project)] end - it { is_expected.to eq('#1, #2, and #3') } + it do + @project = project + + is_expected.to eq('#1, #2, and #3') + end context 'for JIRA issues' do let(:project) { create(:empty_project) } let(:issues) do [ - ExternalIssue.new('JIRA-123', project), ExternalIssue.new('JIRA-456', project), - ExternalIssue.new('FOOBAR-7890', project) + ExternalIssue.new('FOOBAR-7890', project), + ExternalIssue.new('JIRA-123', project) ] end - it { is_expected.to eq('FOOBAR-7890, JIRA-123, and JIRA-456') } + it do + @project = project + is_expected.to eq('FOOBAR-7890, JIRA-123, and JIRA-456') + end + end + + context 'for issues from multiple namespaces' do + let(:project) { create(:project) } + let(:other_project) { create(:project) } + let(:issues) do + [build(:issue, iid: 2, project: project), + build(:issue, iid: 3, project: other_project), + build(:issue, iid: 1, project: project)] + end + + it do + @project = project + + is_expected.to eq("#1, #2, and #{other_project.namespace.path}/#{other_project.path}#3") + end end end |