Sha256: 22478be770abc2c4a3a54d7ed3cee3e180f092bbc74878d3b26306950d5dc0e3

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 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 == 296
      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 include(
        :currency => :PEN,
        :name => "Peruvian nuevo sol",
        :symbol   => nil
      )
    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(
        :name => "Peruvian nuevo sol",
        :currency => :PEN,
        :symbol => nil
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
twitter_cldr-2.0.2 spec/shared/currencies_spec.rb
twitter_cldr-2.0.1 spec/shared/currencies_spec.rb
twitter_cldr-2.0.0 spec/shared/currencies_spec.rb