Sha256: b514a4ee881d3fbbf881e26e518a9f2e96d9991467e8d4f8e647653838d64875

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 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 } } } }
      Numbers.symbols.should == symbols
    end

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

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

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
twitter_cldr-1.8.1 spec/shared/numbers_spec.rb
twitter_cldr-1.8.0 spec/shared/numbers_spec.rb
twitter_cldr-1.7.0 spec/shared/numbers_spec.rb
twitter_cldr-1.6.2 spec/shared/numbers_spec.rb
twitter_cldr-1.6.1 spec/shared/numbers_spec.rb
twitter_cldr-1.6.0 spec/shared/numbers_spec.rb
twitter_cldr-1.5.0 spec/shared/numbers_spec.rb
twitter_cldr-1.4.1 spec/shared/numbers_spec.rb
twitter_cldr-1.4.0 spec/shared/numbers_spec.rb
twitter_cldr-1.3.6 spec/shared/numbers_spec.rb
twitter_cldr-1.3.0 spec/shared/numbers_spec.rb