diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-11-23 17:04:42 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-11-23 17:04:42 +0300 |
commit | 038f5a412d0085f2d9610c77cea37cec75572b27 (patch) | |
tree | 5a3ba500992d5c9409cf52fa8c15e9d9a9b39549 /spec/lib/banzai/filter | |
parent | b8db9c8c8c406d4abc03ba7246bbfecbecfbc784 (diff) | |
parent | e826c5d0917a7fe2225fb6ba0862bc56c1ef3fc2 (diff) |
Merge branch 'jk-group-mentions-fix' into 'master'
Fix link text from group context
Closes gitlab-ee#4100
See merge request gitlab-org/gitlab-ce!15565
Diffstat (limited to 'spec/lib/banzai/filter')
-rw-r--r-- | spec/lib/banzai/filter/issue_reference_filter_spec.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/lib/banzai/filter/issue_reference_filter_spec.rb b/spec/lib/banzai/filter/issue_reference_filter_spec.rb index 3c98b18f99b..f70c69ef588 100644 --- a/spec/lib/banzai/filter/issue_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/issue_reference_filter_spec.rb @@ -343,7 +343,9 @@ describe Banzai::Filter::IssueReferenceFilter do reference = "#{project.full_path}##{issue.iid}" doc = reference_filter("See #{reference}", context) - expect(doc.css('a').first.attr('href')).to eq helper.url_for_issue(issue.iid, project) + link = doc.css('a').first + expect(link.attr('href')).to eq(helper.url_for_issue(issue.iid, project)) + expect(link.text).to include("#{project.full_path}##{issue.iid}") end it 'ignores reference for shorthand cross-reference' do @@ -358,7 +360,9 @@ describe Banzai::Filter::IssueReferenceFilter do doc = reference_filter("See #{reference}", context) - expect(doc.css('a').first.attr('href')).to eq(helper.url_for_issue(issue.iid, project) + "#note_123") + link = doc.css('a').first + expect(link.attr('href')).to eq(helper.url_for_issue(issue.iid, project) + "#note_123") + expect(link.text).to include("#{project.full_path}##{issue.iid}") end it 'links to a valid reference for cross-reference in link href' do @@ -367,7 +371,9 @@ describe Banzai::Filter::IssueReferenceFilter do doc = reference_filter("See #{reference_link}", context) - expect(doc.css('a').first.attr('href')).to eq helper.url_for_issue(issue.iid, project) + "#note_123" + link = doc.css('a').first + expect(link.attr('href')).to eq(helper.url_for_issue(issue.iid, project) + "#note_123") + expect(link.text).to include('Reference') end it 'links to a valid reference for issue reference in the link href' do @@ -375,7 +381,9 @@ describe Banzai::Filter::IssueReferenceFilter do reference_link = %{<a href="#{reference}">Reference</a>} doc = reference_filter("See #{reference_link}", context) - expect(doc.css('a').first.attr('href')).to eq helper.url_for_issue(issue.iid, project) + link = doc.css('a').first + expect(link.attr('href')).to eq(helper.url_for_issue(issue.iid, project)) + expect(link.text).to include('Reference') end end |