Sha256: 9bcab9ea978a4867f9b53904cd3f695082238bbf10b1e4f71be29b59b165e0a5

Contents?: true

Size: 1.19 KB

Versions: 5

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).get_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

5 entries across 5 versions & 1 rubygems

Version Path
twitter_cldr-2.0.2 spec/shared/numbers_spec.rb
twitter_cldr-2.0.1 spec/shared/numbers_spec.rb
twitter_cldr-2.0.0 spec/shared/numbers_spec.rb
twitter_cldr-1.9.1 spec/shared/numbers_spec.rb
twitter_cldr-1.9.0 spec/shared/numbers_spec.rb