Sha256: 6ac24826068beb0c1f13710b69cc2d593d3d890763b4ec33004942dfdd359abf

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe BusinessCatalyst do
  subject { BusinessCatalyst }

  describe "#seo_friendly_url" do
    it "replaces bad SEO chars with '-'" do
      subject.seo_friendly_url("a&b").should eq("a-b")
    end
    it "replaces multiple consecutive bad SEO chars with single '-'" do
      subject.seo_friendly_url("a/;&,#:\"|._@=?()b").should eq("a-b")
    end
    it "replaces whitespace with '-'" do
      subject.seo_friendly_url("a  b").should eq("a-b")
    end
    it "removes leading and trailing whitespace" do
      subject.seo_friendly_url(" a b \n").should eq("a-b")
    end
    it "removes leading and trailing '-'" do
      subject.seo_friendly_url("-a-b-").should eq("a-b")
    end
    it "squishes multiple consecutive '-'" do
      subject.seo_friendly_url("a--b").should eq("a-b")
    end
    it "downcases input" do
      subject.seo_friendly_url("A B").should eq("a-b")
    end
    it "strips random unicode characters" do
      subject.seo_friendly_url("test”®").should eq("test")
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
business_catalyst-0.1.2 spec/lib/business_catalyst/business_catalyst_spec.rb
business_catalyst-0.1.1 spec/lib/business_catalyst/business_catalyst_spec.rb
business_catalyst-0.1.0 spec/lib/business_catalyst/business_catalyst_spec.rb