Sha256: 43e6950e7cbb0b39a72e383aaa9f9721f54fd64f15222686505dddc09fcc524f

Contents?: true

Size: 1.14 KB

Versions: 17

Compression:

Stored size: 1.14 KB

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Localized

describe LocalizedSymbol do

  describe "#as_language_code" do
    it "returns the correct localized language from the symbol" do
      expect(:es.localize.as_language_code).to eq("Spanish")
      TwitterCldr.locale = :es
      expect(:es.localize.as_language_code).to eq("espaƱol")
    end

    it "returns nil if the symbol doesn't correspond to a language code" do
      expect(:blarg.localize.as_language_code).to eq(nil)
    end

    it "returns the correct value for mapped as well as CLDR language codes" do
      expect(:'zh-cn'.localize.as_language_code).to eq("Chinese")
      expect(:'zh-tw'.localize.as_language_code).to eq("Traditional Chinese")
      expect(:'zh-Hant'.localize.as_language_code).to eq("Traditional Chinese")
      expect(:'zh'.localize.as_language_code).to eq("Chinese")
    end
  end

  describe "#is_rtl?" do
    it "should return true or false depending on the locale" do
      expect(:es.localize.is_rtl?).to be_false
      expect(:ar.localize.is_rtl?).to be_true
    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/localized/localized_symbol_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/twitter_cldr-3.2.1/spec/localized/localized_symbol_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/twitter_cldr-3.1.2/spec/localized/localized_symbol_spec.rb
twitter_cldr-3.2.1 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.2.0 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.1.2 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.1.1 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.1.0 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.10 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.9 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.8 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.7 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.6 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.5 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.4 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.3 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.2 spec/localized/localized_symbol_spec.rb