From 1753efbc143d18fe0c29e33319b8779c1d03f7c6 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 20 Jun 2018 16:34:19 +0200 Subject: Add spec for more examples of trailing punctuation that should be ignored --- spec/lib/banzai/filter/label_reference_filter_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'spec/lib/banzai/filter/label_reference_filter_spec.rb') diff --git a/spec/lib/banzai/filter/label_reference_filter_spec.rb b/spec/lib/banzai/filter/label_reference_filter_spec.rb index f34d3dc935b..00257ed7904 100644 --- a/spec/lib/banzai/filter/label_reference_filter_spec.rb +++ b/spec/lib/banzai/filter/label_reference_filter_spec.rb @@ -148,9 +148,11 @@ describe Banzai::Filter::LabelReferenceFilter do 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(\?g\.fm&\.)) + it 'does not include trailing punctuation', :aggregate_failures do + ['.', ', ok?', '...', '?', '!', ': is that ok?'].each do |trailing_punctuation| + doc = filter("Label #{reference}#{trailing_punctuation}") + expect(doc.to_html).to match(%r(\?g\.fm&#{Regexp.escape(trailing_punctuation)})) + end end it 'ignores invalid label names' do -- cgit v1.2.3