added \b (word ending) to tag regex to exclude :;?! etc.; allow : in tags
This commit is contained in:
parent
6623dbb1f1
commit
009bbb826b
2 changed files with 3 additions and 3 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
module Diaspora
|
module Diaspora
|
||||||
module Taggable
|
module Taggable
|
||||||
VALID_TAG_BODY = /[^_,\s#*\[\]()\:\@\/"'\.%]+/
|
VALID_TAG_BODY = /[^_,\s#*\[\]()\@\/"'\.%]+\b/
|
||||||
|
|
||||||
def self.included(model)
|
def self.included(model)
|
||||||
model.class_eval do
|
model.class_eval do
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ describe Diaspora::Taggable do
|
||||||
end
|
end
|
||||||
describe '#tag_strings' do
|
describe '#tag_strings' do
|
||||||
it 'returns a string for every #thing' do
|
it 'returns a string for every #thing' do
|
||||||
str = '#what #hey #that"smybike. #@hey ##boo # #THATWASMYBIKE #vöglein #hey#there #135440we #abc/23 ###'
|
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']
|
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.send(@object.class.field_with_tags_setter, str)
|
||||||
@object.tag_strings.should =~ arr
|
@object.tag_strings.should =~ arr
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue