Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves issue #78 #96

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ext/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def meta_def name, &blk

class String
def slugize
self.downcase.gsub(/&/, 'and').gsub(/\s+/, '-').gsub(/[^a-z0-9-]/, '')
self.downcase.gsub(/&/, 'and').gsub(/[^a-z0-9-]+/, '-').gsub(/^-|-$/, '')
end

def humanize
Expand Down
10 changes: 10 additions & 0 deletions test/toto_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ def readme() "#{self[:name]}'s README" end

should("create a valid summary") { topic.summary.size }.within 75..80
end

context "all non-alphanumeric characters" do
setup do
Toto::Article.new({
:title => "Having fun with //Applescript/Bananascript// and Terminal.app///"
}, @config)
end

should("be replaced with single dash") { topic.slug }.equals "having-fun-with-applescript-bananascript-and-terminal-app"
end
end

context "in a subdirectory" do
Expand Down