Merge pull request #1443 from NeutralAngel/issue_1133
Allow TextSentinel#seems_unpretentious? to accept words joined with dash...
This commit is contained in:
commit
c9ebf23561
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -96,6 +96,14 @@ describe TextSentinel do
|
|||
TextSentinel.new("{{$!").should_not be_valid
|
||||
end
|
||||
|
||||
it "does allow a long alphanumeric string joined with slashes" do
|
||||
TextSentinel.new("gdfgdfgdfg/fgdfgdfgdg/dfgdfgdfgd/dfgdfgdfgf", max_word_length: 30).should be_valid
|
||||
end
|
||||
|
||||
it "does allow a long alphanumeric string joined with dashes" do
|
||||
TextSentinel.new("gdfgdfgdfg-fgdfgdfgdg-dfgdfgdfgd-dfgdfgdfgf", max_word_length: 30).should be_valid
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'title_sentinel' do
|
||||
|
|
Loading…
Reference in New Issue