Commit c9fe94b90d35701fe13b7abeaa7f0b8f548f2ec2

Authored by AntonioTerceiro
1 parent 8512674f

ActionItem280: removing regression from to_slug


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1687 3f533792-8f58-4932-b0fe-aaf55b0a4547
lib/noosfero/core_ext/string.rb
@@ -37,7 +37,7 @@ class String @@ -37,7 +37,7 @@ class String
37 end 37 end
38 38
39 def to_slug 39 def to_slug
40 - transliterate.downcase.gsub(/^\d+/,'').gsub( /[^a-z0-9~\s:;+=_.-]/, '').gsub(/[\s:;+=_.-]+/, '-').gsub(/-$/, '').gsub(/^-/, '').to_s 40 + transliterate.downcase.gsub(/^\d+/,'').gsub( /[^a-z0-9~\s:;+=_.-]/, '').gsub(/[\s:;+=_-]+/, '-').gsub(/-$/, '').gsub(/^-/, '').to_s
41 end 41 end
42 42
43 end 43 end
test/unit/slug_test.rb
@@ -19,8 +19,8 @@ class SlugTest < Test::Unit::TestCase @@ -19,8 +19,8 @@ class SlugTest < Test::Unit::TestCase
19 assert_equal 'a-b', 'a b'.to_slug 19 assert_equal 'a-b', 'a b'.to_slug
20 end 20 end
21 21
22 - should 'remove dots' do  
23 - assert_equal 'a-b', 'a.b'.to_slug 22 + should 'not remove dots' do
  23 + assert_equal 'a.b', 'a.b'.to_slug
24 end 24 end
25 25
26 end 26 end