diff options
author | Robert Speicher <robert@gitlab.com> | 2016-06-30 20:46:20 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-06-30 20:46:20 +0300 |
commit | 6e82c0e06ea25d6d0871037fb09301698ca972bd (patch) | |
tree | 144da3938466c90af68cdc8cafeec4f14485a4b0 /spec | |
parent | f7b056167a3dd79dde7b7fdd87209b478975c546 (diff) | |
parent | 4fca633a317eb065145d3cc687f62eabcb8e8af2 (diff) |
Merge branch 'fix-external-issue-rendering' into 'master'
Handle external issues in IssueReferenceFilter
Rendering issue references such as `#1` was broken for projects using an external issues tracker.
See gitlab-org/gitlab-ce#19036
See merge request !4988
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/banzai/filter/issue_reference_filter_spec.rb | 13 | ||||
-rw-r--r-- | spec/services/git_push_service_spec.rb | 2 |
2 files changed, 15 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 diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb index 1ceb7c3e6ff..48d374883d7 100644 --- a/spec/services/git_push_service_spec.rb +++ b/spec/services/git_push_service_spec.rb @@ -350,6 +350,8 @@ describe GitPushService, services: true do it "doesn't close issues when external issue tracker is in use" do allow_any_instance_of(Project).to receive(:default_issues_tracker?). and_return(false) + external_issue_tracker = double(title: 'My Tracker', issue_path: issue.iid) + allow_any_instance_of(Project).to receive(:external_issue_tracker).and_return(external_issue_tracker) # The push still shouldn't create cross-reference notes. expect do |