Sha256: dc48efad80874de8675e47f8d7f4bad5faa4b0088a6a11042c48c565cf601df4

Contents?: true

Size: 1.2 KB

Versions: 17

Compression:

Stored size: 1.2 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 } } } }
      expect(TwitterCldr::Shared::Numbers.symbols).to eq(symbols)
    end

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

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

    it 'returns nil if the resource is missing' do
      stub(TwitterCldr).get_locale_resource(:nop, :numbers) { nil }
      expect(TwitterCldr::Shared::Numbers.symbols(:nop)).to be_nil
    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/shared/numbers_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/twitter_cldr-3.2.1/spec/shared/numbers_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/twitter_cldr-3.1.2/spec/shared/numbers_spec.rb
twitter_cldr-3.2.1 spec/shared/numbers_spec.rb
twitter_cldr-3.2.0 spec/shared/numbers_spec.rb
twitter_cldr-3.1.2 spec/shared/numbers_spec.rb
twitter_cldr-3.1.1 spec/shared/numbers_spec.rb
twitter_cldr-3.1.0 spec/shared/numbers_spec.rb
twitter_cldr-3.0.10 spec/shared/numbers_spec.rb
twitter_cldr-3.0.9 spec/shared/numbers_spec.rb
twitter_cldr-3.0.8 spec/shared/numbers_spec.rb
twitter_cldr-3.0.7 spec/shared/numbers_spec.rb
twitter_cldr-3.0.6 spec/shared/numbers_spec.rb
twitter_cldr-3.0.5 spec/shared/numbers_spec.rb
twitter_cldr-3.0.4 spec/shared/numbers_spec.rb
twitter_cldr-3.0.3 spec/shared/numbers_spec.rb
twitter_cldr-3.0.2 spec/shared/numbers_spec.rb