added \b (word ending) to tag regex to exclude :;?! etc.; allow : in tags

This commit is contained in:
MrZYX 2011-04-30 00:08:33 +02:00
parent 6623dbb1f1
commit 009bbb826b
2 changed files with 3 additions and 3 deletions

View file

@ -4,7 +4,7 @@
module Diaspora
module Taggable
VALID_TAG_BODY = /[^_,\s#*\[\]()\:\@\/"'\.%]+/
VALID_TAG_BODY = /[^_,\s#*\[\]()\@\/"'\.%]+\b/
def self.included(model)
model.class_eval do

View file

@ -39,8 +39,8 @@ describe Diaspora::Taggable do
end
describe '#tag_strings' do
it 'returns a string for every #thing' do
str = '#what #hey #that"smybike. #@hey ##boo # #THATWASMYBIKE #vöglein #hey#there #135440we #abc/23 ###'
arr = ['what', 'hey', 'that', 'THATWASMYBIKE', 'vöglein', '135440we', 'abc']
str = '#what #hey #that"smybike. #@hey ##boo # #THATWASMYBIKE #vöglein #hey#there #135440we #abc/23 ### #h!gh #ok? #see: #re:publica'
arr = ['what', 'hey', 'that', 'THATWASMYBIKE', 'vöglein', '135440we', 'abc', 'h!gh', 'ok', 'see', 're:publica']
@object.send(@object.class.field_with_tags_setter, str)
@object.tag_strings.should =~ arr