Sha256: 2916a6cc3316b0976faa5c74f79da49ad708256bd0b689eb5ab82d51469fc7c8

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

# encoding: utf-8
#
# This file is part of the lazier gem. Copyright (C) 2012 and above Shogun <shogun_panda@me.com>.
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
#

require "spec_helper"

describe Lazier::String do
  let(:reference) { "abc òùà èé &amp;gt;" }
  let(:translated_reference) { "abc oua ee &amp;gt;" }
  let(:untitleized_reference) { "abc-òùà-èé-&amp;gt;" }
  let(:amp_reference) { "abc òùà èé &gt;" }

  before(:all) do
    ::Lazier.load!
  end

  describe "#remove_accents" do
    it "should translate accents" do
      expect(reference.remove_accents).to eq(translated_reference)
    end
  end

  describe "#untitleize" do
    it "should convert spaces to dashes" do
      expect(reference.untitleize).to eq(untitleized_reference)
    end
  end

  describe "#replace_ampersands" do
    it "should remove HTML ampersands" do
      expect(reference.replace_ampersands).to eq(amp_reference)
    end
  end

  describe "#value" do
    it "should return the string itself" do
      expect(reference.value).to eq(reference)
      expect(translated_reference.value).to eq(translated_reference)
      expect(untitleized_reference.value).to eq(untitleized_reference)
      expect(amp_reference.value).to eq(amp_reference)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lazier-1.0.6 spec/lazier/string_spec.rb
lazier-1.0.5 spec/lazier/string_spec.rb
lazier-1.0.4 spec/lazier/string_spec.rb
lazier-1.0.3 spec/cowtech-extensions/string_spec.rb
lazier-1.0.2 spec/cowtech-extensions/string_spec.rb
lazier-1.0.1 spec/cowtech-extensions/string_spec.rb