Sha256: 02afb432fb0fd4af333bd693e4a3041ff3525a17f33330cdc0b13035c4b82f0f
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
require 'test/unit' $:.unshift(File.expand_path('../lib', File.dirname(__FILE__))) require 'init' require File.dirname(__FILE__) + '/../../../rails/activesupport/lib/active_support' class SlugifyTest < Test::Unit::TestCase def test_should_create_slugs assert_equal 'plain-slug', 'Plain slug'.slugify assert_equal 'café-house', 'café house'.slugify assert_equal 'here-and-now', 'here & now'.slugify assert_equal 'strip-spaces', ' strip spaces '.slugify assert_equal '1-2-3', '1 2 3'.slugify assert_equal 'keep_underscores', 'keep_underscores'.slugify assert_equal 'strip-those-non-chars', "strip #^@tho?se*%$ non-chars".slugify assert_equal 'comin-right-at-ya', "Comin' right at ya'".slugify end def test_should_not_slugify_slugs assert_equal 'plain-slug', 'plain-slug'.slugify end def test_should_create_alternatives_for_existing_slugs assert_equal 'first-1', 'First'.slugify(:increment) assert_equal 'second-2', 'Second 1'.slugify(:increment) assert_equal 'second-2', 'second-1'.slugify(:increment) assert_equal 'second-3', 'second-2'.slugify(:increment) assert_equal 'lots-9533','lots-9532'.slugify(:increment) assert_equal 'lots-9533','lots-009532'.slugify(:increment) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
seamusabshere-slugify-1.0.1 | test/slugify_test.rb |
seamusabshere-slugify-1.0.2 | test/slugify_test.rb |