Sha256: 725a89c37d524a967b58e1ebf74bfae2633809f78dc6b7742871445ab71478bc

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

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

describe String do
  describe "#to_permalink" do
    it "should normalize 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

1 entries across 1 versions & 1 rubygems

Version Path
kitabu-1.0.0.rc1 spec/kitabu/extensions/string_spec.rb