Sha256: 4260c59f873413b3f5a2201456d5b28edb9eb000c8a98a0a11dd55cee00e6f17

Contents?: true

Size: 908 Bytes

Versions: 5

Compression:

Stored size: 908 Bytes

Contents

# frozen_string_literal: true

# rubocop:disable Layout/LineLength

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|
        expect(dirty.to_permalink).to eq(normalized)
      end
    end
  end
end

# rubocop:enable Layout/LineLength

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kitabu-3.1.0 spec/kitabu/extensions/string_spec.rb
kitabu-3.0.3 spec/kitabu/extensions/string_spec.rb
kitabu-3.0.2 spec/kitabu/extensions/string_spec.rb
kitabu-3.0.1 spec/kitabu/extensions/string_spec.rb
kitabu-3.0.0 spec/kitabu/extensions/string_spec.rb