Sha256: 497382e83e85f267d4a67f17dc910031697a430deca7899d9f449191b69e08d6

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 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
      :es.localize.as_language_code.should == "Spanish"
      TwitterCldr.locale = :es
      :es.localize.as_language_code.should == "espaƱol"
    end

    it "returns nil if the symbol doesn't correspond to a language code" do
      :blarg.localize.as_language_code.should == nil
    end

    it "returns the correct value for mapped as well as CLDR language codes" do
      :'zh-cn'.localize.as_language_code.should == "Chinese"
      :'zh-tw'.localize.as_language_code.should == "Traditional Chinese"
      :'zh-Hant'.localize.as_language_code.should == "Traditional Chinese"
      :'zh'.localize.as_language_code.should == "Chinese"
    end
  end

  describe "#is_rtl?" do
    it "should return true or false depending on the locale" do
      :es.localize.is_rtl?.should be_false
      :ar.localize.is_rtl?.should be_true
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
twitter_cldr-3.0.1 spec/localized/localized_symbol_spec.rb
twitter_cldr-2.4.3 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.0 spec/localized/localized_symbol_spec.rb
twitter_cldr-3.0.0.beta1 spec/localized/localized_symbol_spec.rb
twitter_cldr-2.4.2 spec/localized/localized_symbol_spec.rb
twitter_cldr-2.4.1 spec/localized/localized_symbol_spec.rb
twitter_cldr-2.4.0 spec/localized/localized_symbol_spec.rb
twitter_cldr-2.2.0 spec/localized/localized_symbol_spec.rb
twitter_cldr-2.1.1 spec/localized/localized_symbol_spec.rb
twitter_cldr-2.1.0 spec/localized/localized_symbol_spec.rb