Modifies the tag sanitizer to truncate tags longer than 40

I could not make a nice ActAsTaggable error message, this is way faster
This commit is contained in:
kikito
2015-09-09 18:30:27 +02:00
parent 0e96c82faa
commit c750765bca
2 changed files with 8 additions and 1 deletions

View File

@@ -12,6 +12,12 @@ describe TagSanitizer do
it 'filters out dangerous strings' do
expect(subject.sanitize_tag('user_id=1')).to eq('user_id1')
end
it 'sets up a max length for each tag' do
long_tag = '1' * (TagSanitizer::TAG_MAX_LENGTH + 100)
expect(subject.sanitize_tag(long_tag).size).to eq(TagSanitizer::TAG_MAX_LENGTH)
end
end
describe '#sanitize_tag_list' do