Commit f85498c33804d0c9c0938c228cc48a558df19e68

Authored by AntonioTerceiro
1 parent 5a16fa8d

ActionItem24: allowing dots in slugs



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1137 3f533792-8f58-4932-b0fe-aaf55b0a4547
lib/acts_as_filesystem.rb
... ... @@ -97,7 +97,7 @@ module ActsAsFileSystem
97 97 unless self.name.blank?
98 98 # FIXME encapsulate this pattern (transliterate -> downcase -> gsub
99 99 # ...) in a String method, say, to_slug
100   - self.slug = self.name.transliterate.downcase.gsub( /[^-a-z0-9~\s\.:;+=_]/, '').gsub(/[\s\.:;=_+]+/, '-').gsub(/[\-]{2,}/, '-').to_s
  100 + self.slug = self.name.transliterate.downcase.gsub( /[^-a-z0-9~\s\.:;+=_]/, '').gsub(/[\s:;=_+]+/, '-').gsub(/[\-]{2,}/, '-').to_s
101 101 end
102 102 end
103 103  
... ...
test/unit/acts_as_filesystem_test.rb
... ... @@ -50,4 +50,8 @@ class ActsAsFilesystemTest < Test::Unit::TestCase
50 50  
51 51 end
52 52  
  53 + should 'allow dots in slug' do
  54 + assert_equal 'test.txt', Article.new(:name => 'test.txt').slug
  55 + end
  56 +
53 57 end
... ...