Sha256: 6c6c3a35557b816a04688a5d4ba3ce84e3da1667814c6ec46bf8b162cc8cf1d1

Contents?: true

Size: 1.3 KB

Versions: 17

Compression:

Stored size: 1.3 KB

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

require 'spec_helper'

describe TwitterCldr::Normalization do

  describe "#normalize" do
    let(:string) { 'string' }
    let(:normalized_string) { 'normalized' }

    it 'it uses NFD by default' do
      mock(Eprun).normalize(string, :nfd) { normalized_string }
      expect(TwitterCldr::Normalization.normalize(string)).to eq(normalized_string)
    end

    it "uses specified algorithm if there is any" do
      mock(Eprun).normalize(string, :nfkd) { normalized_string }
      expect(TwitterCldr::Normalization.normalize(string, :using => :nfkd)).to eq(normalized_string)
    end

    it "raises an ArgumentError if passed an unsupported normalizer name" do
      expect do
        TwitterCldr::Normalization.normalize(string, :using => :blarg)
      end.to raise_error(ArgumentError)
    end

    it 'accepts normalizer name in upper case' do
      mock(Eprun).normalize(string, :nfkd) { normalized_string }
      expect(TwitterCldr::Normalization.normalize(string, :using => :NFKD)).to eq(normalized_string)
    end

    it 'accepts a string' do
      mock(Eprun).normalize(string, :nfkd) { normalized_string }
      expect(TwitterCldr::Normalization.normalize(string, :using => 'nfkd')).to eq(normalized_string)
    end

  end

end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/twitter_cldr-3.2.1/spec/normalization_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/twitter_cldr-3.2.1/spec/normalization_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/twitter_cldr-3.1.2/spec/normalization_spec.rb
twitter_cldr-3.2.1 spec/normalization_spec.rb
twitter_cldr-3.2.0 spec/normalization_spec.rb
twitter_cldr-3.1.2 spec/normalization_spec.rb
twitter_cldr-3.1.1 spec/normalization_spec.rb
twitter_cldr-3.1.0 spec/normalization_spec.rb
twitter_cldr-3.0.10 spec/normalization_spec.rb
twitter_cldr-3.0.9 spec/normalization_spec.rb
twitter_cldr-3.0.8 spec/normalization_spec.rb
twitter_cldr-3.0.7 spec/normalization_spec.rb
twitter_cldr-3.0.6 spec/normalization_spec.rb
twitter_cldr-3.0.5 spec/normalization_spec.rb
twitter_cldr-3.0.4 spec/normalization_spec.rb
twitter_cldr-3.0.3 spec/normalization_spec.rb
twitter_cldr-3.0.2 spec/normalization_spec.rb