Sha256: ee946d9b6cdb4c1aa5a3fff4355dd48dc2f3212cd2119db4c4ea6a2cebce5eac

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 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
      allow(TwitterCldr).to receive(:locale).and_return(:jp)
      allow(TwitterCldr).to receive(:get_locale_resource).with(:jp, :numbers).and_return(jp: { numbers: { symbols: symbols } })
      expect(TwitterCldr::Shared::Numbers.symbols).to eq(symbols)
    end

    it 'returns numerical symbols for default locale' do
      allow(TwitterCldr).to receive(:get_locale_resource).with(:np, :numbers).and_return(np: { numbers: { symbols: symbols } })
      expect(TwitterCldr::Shared::Numbers.symbols(:np)).to eq(symbols)
    end

    it 'converts locale' do
      allow(TwitterCldr).to receive(:get_locale_resource).with(:'zh-Hant', :numbers).and_return(:'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
      allow(TwitterCldr).to receive(:get_locale_resource).with(:nop, :numbers).and_return(nil)
      expect(TwitterCldr::Shared::Numbers.symbols(:nop)).to be_nil
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/twitter_cldr-4.4.5/spec/shared/numbers_spec.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/twitter_cldr-4.4.5/spec/shared/numbers_spec.rb
twitter_cldr-4.4.5 spec/shared/numbers_spec.rb
twitter_cldr-4.4.4 spec/shared/numbers_spec.rb
twitter_cldr-4.4.3 spec/shared/numbers_spec.rb
twitter_cldr-4.4.2 spec/shared/numbers_spec.rb
twitter_cldr-4.4.1 spec/shared/numbers_spec.rb
twitter_cldr-4.4.0 spec/shared/numbers_spec.rb