Sha256: 1cc6c02f3c54349a1967766f17d6c4aa7d61b1408de5fc0b263925cc84358092

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

# encoding: UTF-8

require File.join(File.dirname(__FILE__), %w[.. spec_helper])
include TwitterCldr::Shared

TEST_COUNTRIES = ["Australia", "Thailand", "Russia", "China", "Japan", "Peru", "South Africa", "India", "South Korea", "United Kingdom"]
TEST_CODES = ["AUD", "THB", "RUB", "CNY", "JPY", "PEN", "ZAR", "INR", "KRW", "GBP"]

describe Currencies do
  describe "#countries" do
    it "should list all supported countries" do
      countries = Currencies.countries
      countries.size.should == 112
      TEST_COUNTRIES.each { |country| countries.should include(country) }
    end
  end

  describe "#currency_codes" do
    it "should list all supported country codes" do
      codes = Currencies.currency_codes
      codes.size.should == 112
      TEST_CODES.each { |code| codes.should include(code) }
    end
  end

  describe "#for_country" do
    it "should return all information for the given country" do
      data = Currencies.for_country("Peru")
      data.should be_a(Hash)

      data.should include(:code)
      data[:code].should == "PEN"
      data.should include(:currency)
      data[:currency].should == "Nuevo Sol"
      data.should include(:symbol)
      data[:symbol].should == "S/."

      data.should_not include(:country)
    end
  end

  describe "#for_code" do
    it "should return all information for the given currency code" do
      data = Currencies.for_code("PEN")
      data.should be_a(Hash)

      data.should include(:country)
      data[:country].should == "Peru"
      data.should include(:currency)
      data[:currency].should == "Nuevo Sol"
      data.should include(:symbol)
      data[:symbol].should == "S/."

      data.should_not include(:code)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-1.0.1 spec/shared/currencies_spec.rb