diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-13 03:48:31 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-07-13 17:42:31 +0300 |
commit | 1167ef4089645e8c043cf9009ff384829421acd7 (patch) | |
tree | 632fdc8532e7af2e070c569c592f9a06b28ef39e /spec/lib/banzai/filter/label_reference_filter_spec.rb | |
parent | f682c0975b3a589d9fc6dae585cf6e36fa9ac348 (diff) |
Fix markdown rendering for label references that contains `.`
Diffstat (limited to 'spec/lib/banzai/filter/label_reference_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/label_reference_filter_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/lib/banzai/filter/label_reference_filter_spec.rb b/spec/lib/banzai/filter/label_reference_filter_spec.rb index 763b8dbc46a..9276a154007 100644 --- a/spec/lib/banzai/filter/label_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/label_reference_filter_spec.rb @@ -93,8 +93,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do end it 'links with adjacent text' do - doc = reference_filter("Label (#{reference}.)") - expect(doc.to_html).to match(%r(\(<a.+><span.+>#{label.name}</span></a>\.\))) + doc = reference_filter("Label (#{reference}).") + expect(doc.to_html).to match(%r(\(<a.+><span.+>#{label.name}</span></a>\)\.)) end it 'ignores invalid label names' do @@ -117,8 +117,8 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do end it 'links with adjacent text' do - doc = reference_filter("Label (#{reference}.)") - expect(doc.to_html).to match(%r(\(<a.+><span.+>#{label.name}</span></a>\.\))) + doc = reference_filter("Label (#{reference}).") + expect(doc.to_html).to match(%r(\(<a.+><span.+>#{label.name}</span></a>\)\.)) end it 'ignores invalid label names' do @@ -129,7 +129,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do end context 'String-based single-word references with special characters' do - let(:label) { create(:label, name: '?gfm&', project: project) } + let(:label) { create(:label, name: '?g.fm&', project: project) } let(:reference) { "#{Label.reference_prefix}#{label.name}" } it 'links to a valid reference' do @@ -137,17 +137,17 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do expect(doc.css('a').first.attr('href')).to eq urls. namespace_project_issues_url(project.namespace, project, label_name: label.name) - expect(doc.text).to eq 'See ?gfm&' + expect(doc.text).to eq 'See ?g.fm&' end it 'links with adjacent text' do - doc = reference_filter("Label (#{reference}.)") - expect(doc.to_html).to match(%r(\(<a.+><span.+>\?gfm&</span></a>\.\))) + doc = reference_filter("Label (#{reference}).") + expect(doc.to_html).to match(%r(\(<a.+><span.+>\?g\.fm&</span></a>\)\.)) end it 'ignores invalid label names' do act = "Label #{Label.reference_prefix}#{label.name.reverse}" - exp = "Label #{Label.reference_prefix}&mfg?" + exp = "Label #{Label.reference_prefix}&mf.g?" expect(reference_filter(act).to_html).to eq exp end @@ -202,7 +202,7 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do end context 'String-based multi-word references with special characters in quotes' do - let(:label) { create(:label, name: 'gfm & references?', project: project) } + let(:label) { create(:label, name: 'g.fm & references?', project: project) } let(:reference) { label.to_reference(format: :name) } it 'links to a valid reference' do @@ -210,17 +210,17 @@ describe Banzai::Filter::LabelReferenceFilter, lib: true do expect(doc.css('a').first.attr('href')).to eq urls. namespace_project_issues_url(project.namespace, project, label_name: label.name) - expect(doc.text).to eq 'See gfm & references?' + expect(doc.text).to eq 'See g.fm & references?' end it 'links with adjacent text' do doc = reference_filter("Label (#{reference}.)") - expect(doc.to_html).to match(%r(\(<a.+><span.+>gfm & references\?</span></a>\.\))) + expect(doc.to_html).to match(%r(\(<a.+><span.+>g\.fm & references\?</span></a>\.\))) end it 'ignores invalid label names' do act = %(Label #{Label.reference_prefix}"#{label.name.reverse}") - exp = %(Label #{Label.reference_prefix}"?secnerefer & mfg\") + exp = %(Label #{Label.reference_prefix}"?secnerefer & mf.g\") expect(reference_filter(act).to_html).to eq exp end |