Sha256: 2a8e2cc99c46e7234975c3ff702268db5749252dc5498464f5174ca6f809ac85

Contents?: true

Size: 1.71 KB

Versions: 10

Compression:

Stored size: 1.71 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 = ["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

10 entries across 10 versions & 1 rubygems

Version Path
twitter_cldr-1.6.2 spec/shared/currencies_spec.rb
twitter_cldr-1.6.1 spec/shared/currencies_spec.rb
twitter_cldr-1.6.0 spec/shared/currencies_spec.rb
twitter_cldr-1.5.0 spec/shared/currencies_spec.rb
twitter_cldr-1.4.1 spec/shared/currencies_spec.rb
twitter_cldr-1.4.0 spec/shared/currencies_spec.rb
twitter_cldr-1.3.6 spec/shared/currencies_spec.rb
twitter_cldr-1.3.0 spec/shared/currencies_spec.rb
twitter_cldr-1.2.0 spec/shared/currencies_spec.rb
twitter_cldr-1.1.0 spec/shared/currencies_spec.rb