Sha256: 53b9317b5b8ee539f56ffbcc92a7baabd7ec956eb114af55ee0269082e175587

Contents?: true

Size: 1.19 KB

Versions: 10

Compression:

Stored size: 1.19 KB

Contents

# encoding: UTF-8

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

require 'spec_helper'

include TwitterCldr::Shared

describe Numbers do
  describe "#symbols" do
    let(:symbols) { { :nan => 'NaN', :minus_sign => '-' } }

    it 'returns numerical symbols for default locale' do
      stub(TwitterCldr).locale { :jp }
      stub(TwitterCldr).get_locale_resource(:jp, :numbers) { { :jp => { :numbers => { :symbols => symbols } } } }
      TwitterCldr::Shared::Numbers.symbols.should == symbols
    end

    it 'returns numerical symbols for default locale' do
      stub(TwitterCldr).get_locale_resource(:np, :numbers) { { :np => { :numbers => { :symbols => symbols } } } }
      TwitterCldr::Shared::Numbers.symbols(:np).should == symbols
    end

    it 'converts locale' do
      stub(TwitterCldr).get_locale_resource(:'zh-Hant', :numbers) { { :'zh-Hant' => { :numbers => { :symbols => symbols } } } }
      TwitterCldr::Shared::Numbers.symbols('zh-tw').should == symbols
    end

    it 'returns nil if the resource is missing' do
      stub(TwitterCldr).get_locale_resource(:nop, :numbers) { nil }
      TwitterCldr::Shared::Numbers.symbols(:nop).should be_nil
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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