From 4ab9ef3497fbd94f33aff6440c067cca9b7a9ca2 Mon Sep 17 00:00:00 2001 From: Robin Ward <robin.ward@gmail.com> Date: Tue, 19 May 2015 13:10:25 -0400 Subject: [PATCH] FIX: Allow long words if they contain periods --- lib/text_sentinel.rb | 2 +- spec/components/text_sentinel_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/text_sentinel.rb b/lib/text_sentinel.rb index f5b2cf1fd..1210ad379 100644 --- a/lib/text_sentinel.rb +++ b/lib/text_sentinel.rb @@ -67,7 +67,7 @@ class TextSentinel def seems_unpretentious? # Don't allow super long words if there is a word length maximum - @opts[:max_word_length].blank? || @text.split(/\s|\/|-/).map(&:size).max <= @opts[:max_word_length] + @opts[:max_word_length].blank? || @text.split(/\s|\/|-|\./).map(&:size).max <= @opts[:max_word_length] end diff --git a/spec/components/text_sentinel_spec.rb b/spec/components/text_sentinel_spec.rb index ce19e4162..cd9e41d66 100644 --- a/spec/components/text_sentinel_spec.rb +++ b/spec/components/text_sentinel_spec.rb @@ -104,6 +104,10 @@ describe TextSentinel do expect(TextSentinel.new("gdfgdfgdfg-fgdfgdfgdg-dfgdfgdfgd-dfgdfgdfgf", max_word_length: 30)).to be_valid end + it "allows a long string with periods" do + expect(TextSentinel.new("error in org.gradle.internal.graph.CachingDirectedGraphWalker", max_word_length: 30)).to be_valid + end + end context 'title_sentinel' do