Sha256: ac9949479b7f153b8afc5184cf5f10ecc73d8992382c9791419a13dbd747c719
Contents?: true
Size: 1.35 KB
Versions: 27
Compression:
Stored size: 1.35 KB
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'spec_helper' describe TwitterCldr::Shared::NumberingSystem do describe "#for_name" do it "should return the correct numbering system for the given name" do expect(described_class.for_name("latn").digits).to eq(%w(0 1 2 3 4 5 6 7 8 9)) expect(described_class.for_name("arab").digits).to eq(%w(٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩)) end it "should raise an error if the system is not numeric" do expect { described_class.for_name("roman") }.to( raise_error(TwitterCldr::Shared::UnsupportedNumberingSystemError) ) end end describe "#transliterate" do context "with the arabic numbering system" do let(:system) { described_class.for_name("arab") } it "replaces ascii numeral characters with arabic ones" do expect(system.transliterate(123)).to match_normalized("١٢٣") expect(system.transliterate(947)).to match_normalized("٩٤٧") end end context "with the Han decimal system" do let(:system) { described_class.for_name("hanidec") } it "replaces ascii numeral characters with Han ones" do expect(system.transliterate(123)).to match_normalized("一二三") expect(system.transliterate(947)).to match_normalized("九四七") end end end end
Version data entries
27 entries across 27 versions & 1 rubygems