Sha256: ec9d9f0d7be4365cf0094ed6d1fc45dfb3a905175701255599029d58671f4fe2

Contents?: true

Size: 825 Bytes

Versions: 9

Compression:

Stored size: 825 Bytes

Contents

# -*- encoding: utf-8 -*-
require "spec_helper"

describe String do
  describe "#to_permalink" do
    it "normalizes strings" do
      {
        'This IS a Tripped out title!!.!1  (well/ not really)' => 'this-is-a-tripped-out-title-1-well-not-really',
        '////// meph1sto r0x ! \\\\\\' => 'meph1sto-r0x',
        'āčēģīķļņū' => 'acegiklnu',
        '中文測試 chinese text' => 'chinese-text',
        'some-)()()-ExtRa!/// .data==?>    to \/\/test' => 'some-extra-data-to-test',
        'http://simplesideias.com.br/tags/' => 'http-simplesideias-com-br-tags',
        "Don't Repeat Yourself (DRY)" => 'don-t-repeat-yourself-dry',
        "Text\nwith\nline\n\n\tbreaks" => 'text-with-line-breaks'
      }.each do |dirty, normalized|
        dirty.to_permalink.should == normalized
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kitabu-1.0.5 spec/kitabu/extensions/string_spec.rb
kitabu-1.0.4 spec/kitabu/extensions/string_spec.rb
kitabu-1.0.3 spec/kitabu/extensions/string_spec.rb
kitabu-1.0.2 spec/kitabu/extensions/string_spec.rb
kitabu-1.0.1 spec/kitabu/extensions/string_spec.rb
kitabu-1.0.0 spec/kitabu/extensions/string_spec.rb
kitabu-1.0.0.rc4 spec/kitabu/extensions/string_spec.rb
kitabu-1.0.0.rc3 spec/kitabu/extensions/string_spec.rb
kitabu-1.0.0.rc2 spec/kitabu/extensions/string_spec.rb