Sha256: 8c188c2e534e9a830bf41c9c3505f22a9656e36777075bddc95f33fc87ae76c5
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 require 'spec_helper' include TwitterCldr::Shared TEST_COUNTRIES = ["Australia", "Thailand", "Russia", "China", "Japan", "Peru", "South Africa", "India", "South Korea", "United Kingdom"] TEST_CODES = %w[AUD THB RUB CNY JPY PEN ZAR INR KRW GBP] describe Currencies do describe "#currency_codes" do it "should list all supported country codes" do codes = Currencies.currency_codes codes.size.should == 296 codes.should include(*TEST_CODES) end end describe "#for_code" do it "should return all information for PEN" do data = Currencies.for_code("PEN") data.should be_a(Hash) data.should include( :name => "Peruvian nuevo sol", :currency => :PEN, :symbol => "S/.", :cldr_symbol => "PEN" ) end it "should return all information for CAD, a currency code with multiple possible symbols" do data = Currencies.for_code("CAD") data.should be_a(Hash) data.should include( :name => "Canadian dollar", :currency => :CAD, :symbol => "$", :cldr_symbol => "CA$" ) end it "verifies that all code_points values are equivalent to their corresponding symbols" do Currencies.currency_codes.select do |code| data = Currencies.for_code(code) data[:code_points].pack("U*").should == data[:symbol] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
twitter_cldr-2.2.0 | spec/shared/currencies_spec.rb |
twitter_cldr-2.1.1 | spec/shared/currencies_spec.rb |
twitter_cldr-2.1.0 | spec/shared/currencies_spec.rb |