Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 29 additions & 39 deletions lib/locales/en/currency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ en:
- AFN
- ALL
- AMD
- ANG
- AOA
- ARS
- AUD
Expand All @@ -15,16 +14,16 @@ en:
- BAM
- BBD
- BDT
- BGN
- BHD
- BIF
- BMD
- BND
- BOB
- BRL
- BSD
- BTN
- BWP
- BYR
- BYN
- BZD
- CAD
- CDF
Expand All @@ -40,7 +39,6 @@ en:
- DKK
- DOP
- DZD
- EEK
- EGP
- ERN
- ETB
Expand All @@ -57,13 +55,11 @@ en:
- GYD
- HKD
- HNL
- HRK
- HTG
- HUF
- IDR
- ILS
- INR
- INR
- IQD
- IRR
- ISK
Expand All @@ -83,8 +79,7 @@ en:
- LBP
- LKR
- LRD
- LTL
- LVL
- LSL
- LYD
- MAD
- MDL
Expand All @@ -93,13 +88,14 @@ en:
- MMK
- MNT
- MOP
- MRO
- MRU
- MUR
- MVR
- MWK
- MXN
- MYR
- MZN
- NAD
- NGN
- NIO
- NOK
Expand All @@ -125,10 +121,11 @@ en:
- SEK
- SGD
- SHP
- SLL
- SLE
- SOS
- SRD
- STD
- SSP
- STN
- SVC
- SYP
- SZL
Expand All @@ -146,7 +143,7 @@ en:
- USD
- UYU
- UZS
- VEF
- VES
- VND
- VUV
- WST
Expand All @@ -158,25 +155,22 @@ en:
- XBC
- XBD
- XCD
- XCG
- XDR
- XFU
- XOF
- XPD
- XPF
- XPT
- XTS
- YER
- ZAR
- ZAR
- ZAR
- ZMK
- ZWL
- ZMW
- ZWG
name:
- UAE Dirham
- Afghani
- Lek
- Armenian Dram
- Netherlands Antillian Guilder
- Kwanza
- Argentine Peso
- Australian Dollar
Expand All @@ -185,32 +179,31 @@ en:
- Convertible Marks
- Barbados Dollar
- Taka
- Bulgarian Lev
- Bahraini Dinar
- Burundi Franc
- Bermudian Dollar (customarily known as Bermuda Dollar)
- Brunei Dollar
- Boliviano Mvdol
- Boliviano
- Brazilian Real
- Bahamian Dollar
- Ngultrum
- Pula
- Belarussian Ruble
- Belarusian Ruble
- Belize Dollar
- Canadian Dollar
- Congolese Franc
- Swiss Franc
- Chilean Peso Unidades de fomento
- Chilean Peso
- Yuan Renminbi
- Colombian Peso Unidad de Valor Real
- Colombian Peso
- Costa Rican Colon
- Cuban Peso Peso Convertible
- Cuban Peso
- Cape Verde Escudo
- Czech Koruna
- Djibouti Franc
- Danish Krone
- Dominican Peso
- Algerian Dinar
- Kroon
- Egyptian Pound
- Nakfa
- Ethiopian Birr
Expand All @@ -227,13 +220,11 @@ en:
- Guyana Dollar
- Hong Kong Dollar
- Lempira
- Croatian Kuna
- Gourde US Dollar
- Gourde
- Forint
- Rupiah
- New Israeli Sheqel
- Indian Rupee
- Indian Rupee Ngultrum
- Iraqi Dinar
- Iranian Rial
- Iceland Krona
Expand All @@ -253,8 +244,7 @@ en:
- Lebanese Pound
- Sri Lanka Rupee
- Liberian Dollar
- Lithuanian Litas
- Latvian Lats
- Loti
- Libyan Dinar
- Moroccan Dirham
- Moldovan Leu
Expand All @@ -267,16 +257,17 @@ en:
- Mauritius Rupee
- Rufiyaa
- Kwacha
- Mexican Peso Mexican Unidad de Inversion (UDI)
- Mexican Peso
- Malaysian Ringgit
- Metical
- Namibia Dollar
- Naira
- Cordoba Oro
- Norwegian Krone
- Nepalese Rupee
- New Zealand Dollar
- Rial Omani
- Balboa US Dollar
- Balboa
- Nuevo Sol
- Kina
- Philippine Peso
Expand All @@ -298,8 +289,9 @@ en:
- Leone
- Somali Shilling
- Surinam Dollar
- South Sudanese Pound
- Dobra
- El Salvador Colon US Dollar
- El Salvador Colon
- Syrian Pound
- Lilangeni
- Baht
Expand All @@ -314,9 +306,9 @@ en:
- Hryvnia
- Uganda Shilling
- US Dollar
- Peso Uruguayo Uruguay Peso en Unidades Indexadas
- Peso Uruguayo
- Uzbekistan Sum
- Bolivar Fuerte
- Bolivar Soberano
- Dong
- Vatu
- Tala
Expand All @@ -328,19 +320,17 @@ en:
- European Unit of Account 9(E.U.A.-9)
- European Unit of Account 17(E.U.A.-17)
- East Caribbean Dollar
- Caribbean Guilder
- SDR
- UIC-Franc
- CFA Franc BCEAO
- Palladium
- CFP Franc
- Platinum
- Codes specifically reserved for testing purposes
- Yemeni Rial
- Rand
- Rand Loti
- Rand Namibia Dollar
- Zambian Kwacha
- Zimbabwe Dollar
- Zimbabwe Gold
symbol:
- HK$
- Ft
Expand Down
18 changes: 18 additions & 0 deletions test/faker/default/test_faker_currency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ def test_code
assert_match(/[A-Z]{3}/, @tester.code)
end

def test_codes_are_unique
codes = I18n.translate('faker.currency.code', locale: :en)
duplicates = codes.tally.select { |_code, count| count > 1 }.keys

assert_empty duplicates, "duplicated currency codes: #{duplicates.join(', ')}"
end

def test_names_name_a_single_currency
names = I18n.translate('faker.currency.name', locale: :en)
# Rows of the ISO 4217 table where a country uses two currencies used to be
# read as one entry, leaving names such as 'Rand Namibia Dollar'.
glued = names.select do |name|
names.any? { |other| other != name && name.start_with?("#{other} ") }
end

assert_empty glued, "names holding two currencies: #{glued.join(', ')}"
end

def test_symbol
assert_instance_of String, @tester.symbol
end
Expand Down
Loading