diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-28 18:50:17 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-06-30 12:52:44 +0300 |
commit | a4ce2d126d969722af7152c4be2c8a6dde3104b5 (patch) | |
tree | d65701227d80752d4a6cd583af9a082866bbc2ab /spec/lib/banzai/filter/issue_reference_filter_spec.rb | |
parent | bef4294c58e0bbadc01f633fc8bea514801de7ae (diff) |
Handle external issues in IssueReferenceFilter
IssueReferenceFilter will end up processing internal issue references
when a project uses an external issues tracker while still using
internal issue references (in the form of `#\d+`). This commit ensures
that these links are rendered as external issue links, regardless of
whether the project one currently views uses an internal or external
issues tracker.
Fixes gitlab-org/gitlab-ce#19036, gitlab-com/performance#16
Diffstat (limited to 'spec/lib/banzai/filter/issue_reference_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/issue_reference_filter_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/issue_reference_filter_spec.rb b/spec/lib/banzai/filter/issue_reference_filter_spec.rb index 8d6ce114aa9..a005b4990e7 100644 --- a/spec/lib/banzai/filter/issue_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/issue_reference_filter_spec.rb @@ -199,6 +199,19 @@ describe Banzai::Filter::IssueReferenceFilter, lib: true do end end + context 'referencing external issues' do + let(:project) { create(:redmine_project) } + + it 'renders internal issue IDs as external issue links' do + doc = reference_filter('#1') + link = doc.css('a').first + + expect(link.attr('data-reference-type')).to eq('external_issue') + expect(link.attr('title')).to eq('Issue in Redmine') + expect(link.attr('data-external-issue')).to eq('1') + end + end + describe '#issues_per_Project' do context 'using an internal issue tracker' do it 'returns a Hash containing the issues per project' do |