Sha256: 19ab21ded97b1dc75b4c48ed29d9954e4c24bbdd51371249829a12ac927442f6

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 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 "#countries" do
    it "should list all supported countries" do
      countries = Currencies.countries

      countries.size.should == 112
      countries.should include(*TEST_COUNTRIES)
    end
  end

  describe "#currency_codes" do
    it "should list all supported country codes" do
      codes = Currencies.currency_codes

      codes.size.should == 112
      codes.should include(*TEST_CODES)
    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_not include(:country)
      data.should include(
        :code     => "PEN",
        :currency => "Nuevo Sol",
        :symbol   => "S/."
      )
    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_not include(:code)
      data.should include(
          :country  => "Peru",
          :currency => "Nuevo Sol",
          :symbol   => "S/."
      )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter_cldr-1.9.1 spec/shared/currencies_spec.rb
twitter_cldr-1.9.0 spec/shared/currencies_spec.rb
twitter_cldr-1.8.1 spec/shared/currencies_spec.rb
twitter_cldr-1.8.0 spec/shared/currencies_spec.rb
twitter_cldr-1.7.0 spec/shared/currencies_spec.rb