money_helper 0.0.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWZjMTgyNzQwNTY2ZjQzOTEzNzQxYTQyMmIxYjk1Yjc5ZjU2OWQ5Yg==
4
+ ZWIyMmI3OTU3NmUxMjQ2OTBhMDMwMWE3OGI0YTZmYWNlMWIxM2I5MA==
5
5
  data.tar.gz: !binary |-
6
- ZWRhNjgyOTJiN2ViZjdkMTExMDkwZGJmYTU2ZTI4NDc1NjY0NzczMQ==
6
+ MGFjMWQ5MTRlMzVkYWRjMTA0ZGI1NDQxNjk3NzUzNDRjZWEzM2ZmOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OThjNWYzNjBmNjA5MGJjNjEzNWE3ZGJkOTBiMTdiZWVlZmQ1ODkyZGI0OTFk
10
- Yzg5YTdkZjA2YjY1NGMwODNmYTIzMDIyOGRmNDdmMDMxNTBiZWNiNWNjYmVi
11
- N2MyNjNlZThlYTEzOGQxOTg3MDAxNWI0N2Q5NjQwNWU1MGZhOTQ=
9
+ OWIzN2QxZDUwOTMyNWFiMTZmZTdhNzIwZDMwZDBkMmJmMWMzMjQ5YjNiMGE4
10
+ YzgxYWRlN2YyMGYyODJkNDI4NmI4ZjliZmM4MTM0ZTMzYTc1MWRjOWFlOTE4
11
+ YmJiY2NiMmU4YzFhM2JlNjM0M2EyYzE2ZGI3MmIzY2YwOGQ3MDA=
12
12
  data.tar.gz: !binary |-
13
- MjUyMTE5NzY0MjA1NWY3MDVhNmYwNDk5NDg4YzRkZTBjMTgxOGE2MmIyOGUx
14
- NzNhMWZmNmJkOTEzZTc2MTViOTBlNmMzMmYxMjJmYTQ0NTc1NDRkZTYwODc1
15
- M2M5MWU1ZmExYTllMmQ2YzlhNDU1MGIwNDIyZWQxNDkzZWRmM2M=
13
+ ZTVkOWYyZDMzOWM1NmY5NDc1MTRlYmFkNDIwNjk3N2VkNDUwNDI5YWZkZGVi
14
+ NTAzM2ZhYmQzZWJmNDA3YTllYTg5ZTg1MDcwYjQ0ZmY2MjJlMmI2MGEyMTFj
15
+ M2NlMjllZDczMDgxZWE2NDhiMzMwYTc0MGZmMzYxMzlhYTUzMDU=
@@ -4,10 +4,11 @@ require 'active_support/core_ext/object/blank'
4
4
  require 'money'
5
5
 
6
6
  module MoneyHelper
7
+ I18n.enforce_available_locales = false
7
8
 
8
- SYMBOL_ONLY = %w{USD GBP EUR MYR TRY} #don't use ISO code
9
+ SYMBOL_ONLY = %w{USD GBP EUR MYR} #don't use ISO code
9
10
  OK_SYMBOLS = %w{
10
- $ £ € ¥ 元 р. L ƒ ৳ P R$ K ₡ D ლ ₵ Q G ₹ Rp ₪ ₩ ₭ R RM ₨ ₮ դր. C$ ₦ TL ₲ ₱ T ฿ T$ m ₴ ₫ ៛
11
+ $ £ € ¥ 元 р. L ƒ ৳ P R$ K ₡ D ლ ₵ Q G ₹ Rp ₪ ₩ ₭ R RM ₨ ₮ դր. C$ ₦ ₲ ₱ T ฿ T$ m ₴ ₫ ៛ ₺ E ₽
11
12
  } #ok to include in string
12
13
 
13
14
  ##
@@ -5,174 +5,174 @@ require 'money_helper'
5
5
  describe MoneyHelper do
6
6
  describe "money_to_text" do
7
7
  it "includes only symbol for well-recognizable currencies" do
8
- MoneyHelper.money_to_text(30000, "EUR").should eql("€30.000")
9
- MoneyHelper.money_to_text(30000, "GBP").should eql("£30,000")
10
- MoneyHelper.money_to_text(30000, "MYR").should eql("RM30,000")
11
- MoneyHelper.money_to_text(30000, "TRY").should eql("TL30.000")
12
- MoneyHelper.money_to_text(30000, "USD").should eql("$30,000")
8
+ expect(MoneyHelper.money_to_text(30000, "EUR")).to eql("€30.000")
9
+ expect(MoneyHelper.money_to_text(30000, "GBP")).to eql("£30,000")
10
+ expect(MoneyHelper.money_to_text(30000, "MYR")).to eql("RM30,000")
11
+ expect(MoneyHelper.money_to_text(30000, "TRY")).to eql("TRY ₺30.000")
12
+ expect(MoneyHelper.money_to_text(30000, "USD")).to eql("$30,000")
13
13
  end
14
14
  it "includes ISO code and symbol for ambiguous currencies" do
15
- MoneyHelper.money_to_text(30000, "AUD").should eql("AUD $30,000")
16
- MoneyHelper.money_to_text(30000, "ARS").should eql("ARS $30.000")
17
- MoneyHelper.money_to_text(30000, "BBD").should eql("BBD $30,000")
18
- MoneyHelper.money_to_text(30000, "BMD").should eql("BMD $30,000")
19
- MoneyHelper.money_to_text(30000, "BND").should eql("BND $30,000")
20
- MoneyHelper.money_to_text(30000, "BSD").should eql("BSD $30,000")
21
- MoneyHelper.money_to_text(30000, "BZD").should eql("BZD $30,000")
22
- MoneyHelper.money_to_text(30000, "CAD").should eql("CAD $30,000")
23
- MoneyHelper.money_to_text(30000, "CLP").should eql("CLP $30.000")
24
- MoneyHelper.money_to_text(30000, "COP").should eql("COP $30.000")
25
- MoneyHelper.money_to_text(30000, "CUC").should eql("CUC $30,000")
26
- MoneyHelper.money_to_text(30000, "CUP").should eql("CUP $30,000")
27
- MoneyHelper.money_to_text(30000, "DOP").should eql("DOP $30,000")
28
- MoneyHelper.money_to_text(30000, "FJD").should eql("FJD $30,000")
29
- MoneyHelper.money_to_text(30000, "GYD").should eql("GYD $30,000")
30
- MoneyHelper.money_to_text(30000, "HKD").should eql("HKD $30,000")
31
- MoneyHelper.money_to_text(30000, "JMD").should eql("JMD $30,000")
32
- MoneyHelper.money_to_text(30000, "KYD").should eql("KYD $30,000")
33
- MoneyHelper.money_to_text(30000, "LRD").should eql("LRD $30,000")
34
- MoneyHelper.money_to_text(30000, "MXN").should eql("MXN $30,000")
35
- MoneyHelper.money_to_text(30000, "NAD").should eql("NAD $30,000")
36
- MoneyHelper.money_to_text(30000, "NZD").should eql("NZD $30,000")
37
- MoneyHelper.money_to_text(30000, "SBD").should eql("SBD $30,000")
38
- MoneyHelper.money_to_text(30000, "SGD").should eql("SGD $30,000")
39
- MoneyHelper.money_to_text(30000, "SRD").should eql("SRD $30,000")
40
- MoneyHelper.money_to_text(30000, "TWD").should eql("TWD $30,000")
41
- MoneyHelper.money_to_text(30000, "TTD").should eql("TTD $30,000")
42
- MoneyHelper.money_to_text(30000, "UYU").should eql("UYU $30.000")
43
- MoneyHelper.money_to_text(30000, "XCD").should eql("XCD $30,000")
44
- MoneyHelper.money_to_text(30000, "ZWL").should eql("ZWL $30,000")
15
+ expect(MoneyHelper.money_to_text(30000, "AUD")).to eql("AUD $30,000")
16
+ expect(MoneyHelper.money_to_text(30000, "ARS")).to eql("ARS $30.000")
17
+ expect(MoneyHelper.money_to_text(30000, "BBD")).to eql("BBD $30,000")
18
+ expect(MoneyHelper.money_to_text(30000, "BMD")).to eql("BMD $30,000")
19
+ expect(MoneyHelper.money_to_text(30000, "BND")).to eql("BND $30,000")
20
+ expect(MoneyHelper.money_to_text(30000, "BSD")).to eql("BSD $30,000")
21
+ expect(MoneyHelper.money_to_text(30000, "BZD")).to eql("BZD $30,000")
22
+ expect(MoneyHelper.money_to_text(30000, "CAD")).to eql("CAD $30,000")
23
+ expect(MoneyHelper.money_to_text(30000, "CLP")).to eql("CLP $30.000")
24
+ expect(MoneyHelper.money_to_text(30000, "COP")).to eql("COP $30.000")
25
+ expect(MoneyHelper.money_to_text(30000, "CUC")).to eql("CUC $30,000")
26
+ expect(MoneyHelper.money_to_text(30000, "CUP")).to eql("CUP $30,000")
27
+ expect(MoneyHelper.money_to_text(30000, "DOP")).to eql("DOP $30,000")
28
+ expect(MoneyHelper.money_to_text(30000, "FJD")).to eql("FJD $30,000")
29
+ expect(MoneyHelper.money_to_text(30000, "GYD")).to eql("GYD $30,000")
30
+ expect(MoneyHelper.money_to_text(30000, "HKD")).to eql("HKD $30,000")
31
+ expect(MoneyHelper.money_to_text(30000, "JMD")).to eql("JMD $30,000")
32
+ expect(MoneyHelper.money_to_text(30000, "KYD")).to eql("KYD $30,000")
33
+ expect(MoneyHelper.money_to_text(30000, "LRD")).to eql("LRD $30,000")
34
+ expect(MoneyHelper.money_to_text(30000, "MXN")).to eql("MXN $30,000")
35
+ expect(MoneyHelper.money_to_text(30000, "NAD")).to eql("NAD $30,000")
36
+ expect(MoneyHelper.money_to_text(30000, "NZD")).to eql("NZD $30,000")
37
+ expect(MoneyHelper.money_to_text(30000, "SBD")).to eql("SBD $30,000")
38
+ expect(MoneyHelper.money_to_text(30000, "SGD")).to eql("SGD $30,000")
39
+ expect(MoneyHelper.money_to_text(30000, "SRD")).to eql("SRD $30,000")
40
+ expect(MoneyHelper.money_to_text(30000, "TWD")).to eql("TWD $30,000")
41
+ expect(MoneyHelper.money_to_text(30000, "TTD")).to eql("TTD $30,000")
42
+ expect(MoneyHelper.money_to_text(30000, "UYU")).to eql("UYU $30.000")
43
+ expect(MoneyHelper.money_to_text(30000, "XCD")).to eql("XCD $30,000")
44
+ expect(MoneyHelper.money_to_text(30000, "ZWL")).to eql("ZWL $30,000")
45
45
 
46
- MoneyHelper.money_to_text(30000, "FKP").should eql("FKP £30,000")
47
- MoneyHelper.money_to_text(30000, "GIP").should eql("GIP £30,000")
48
- MoneyHelper.money_to_text(30000, "SDG").should eql("SDG £30,000")
49
- MoneyHelper.money_to_text(30000, "SHP").should eql("SHP £30,000")
46
+ expect(MoneyHelper.money_to_text(30000, "FKP")).to eql("FKP £30,000")
47
+ expect(MoneyHelper.money_to_text(30000, "GIP")).to eql("GIP £30,000")
48
+ expect(MoneyHelper.money_to_text(30000, "SDG")).to eql("SDG £30,000")
49
+ expect(MoneyHelper.money_to_text(30000, "SHP")).to eql("SHP £30,000")
50
50
 
51
- MoneyHelper.money_to_text(30000, "CNY").should eql("CNY ¥30,000")
52
- MoneyHelper.money_to_text(30000, "JPY").should eql("JPY ¥30,000")
51
+ expect(MoneyHelper.money_to_text(30000, "CNY")).to eql("CNY ¥30,000")
52
+ expect(MoneyHelper.money_to_text(30000, "JPY")).to eql("JPY ¥30,000")
53
53
 
54
- MoneyHelper.money_to_text(30000, "ALL").should eql("ALL L30,000")
55
- MoneyHelper.money_to_text(30000, "HNL").should eql("HNL L30,000")
56
- MoneyHelper.money_to_text(30000, "LSL").should eql("LSL L30,000")
57
- MoneyHelper.money_to_text(30000, "MDL").should eql("MDL L30,000")
58
- MoneyHelper.money_to_text(30000, "RON").should eql("RON 30.000")
59
- MoneyHelper.money_to_text(30000, "SZL").should eql("SZL L30,000")
54
+ expect(MoneyHelper.money_to_text(30000, "ALL")).to eql("ALL L30,000")
55
+ expect(MoneyHelper.money_to_text(30000, "HNL")).to eql("HNL L30,000")
56
+ expect(MoneyHelper.money_to_text(30000, "LSL")).to eql("LSL L30,000")
57
+ expect(MoneyHelper.money_to_text(30000, "MDL")).to eql("MDL L30,000")
58
+ expect(MoneyHelper.money_to_text(30000, "RON")).to eql("RON 30.000")
59
+ expect(MoneyHelper.money_to_text(30000, "SZL")).to eql("SZL E30,000")
60
60
 
61
- MoneyHelper.money_to_text(30000, "ANG").should eql("ANG ƒ30.000")
62
- MoneyHelper.money_to_text(30000, "AWG").should eql("AWG ƒ30,000")
61
+ expect(MoneyHelper.money_to_text(30000, "ANG")).to eql("ANG ƒ30.000")
62
+ expect(MoneyHelper.money_to_text(30000, "AWG")).to eql("AWG ƒ30,000")
63
63
 
64
- MoneyHelper.money_to_text(30000, "BWP").should eql("BWP P30,000")
65
- MoneyHelper.money_to_text(30000, "MOP").should eql("MOP P30,000")
64
+ expect(MoneyHelper.money_to_text(30000, "BWP")).to eql("BWP P30,000")
65
+ expect(MoneyHelper.money_to_text(30000, "MOP")).to eql("MOP P30,000")
66
66
 
67
- MoneyHelper.money_to_text(30000, "CRC").should eql("CRC ₡30.000")
68
- MoneyHelper.money_to_text(30000, "SVC").should eql("SVC ₡30,000")
67
+ expect(MoneyHelper.money_to_text(30000, "CRC")).to eql("CRC ₡30.000")
68
+ expect(MoneyHelper.money_to_text(30000, "SVC")).to eql("SVC ₡30,000")
69
69
 
70
- MoneyHelper.money_to_text(30000, "MUR").should eql("MUR ₨30,000")
71
- MoneyHelper.money_to_text(30000, "NPR").should eql("NPR ₨30,000")
72
- MoneyHelper.money_to_text(30000, "PKR").should eql("PKR ₨30,000")
73
- MoneyHelper.money_to_text(30000, "SCR").should eql("SCR ₨30,000")
70
+ expect(MoneyHelper.money_to_text(30000, "MUR")).to eql("MUR ₨30,000")
71
+ expect(MoneyHelper.money_to_text(30000, "NPR")).to eql("NPR ₨30,000")
72
+ expect(MoneyHelper.money_to_text(30000, "PKR")).to eql("PKR ₨30,000")
73
+ expect(MoneyHelper.money_to_text(30000, "SCR")).to eql("SCR ₨30,000")
74
74
  end
75
75
  it "includes ISO code and symbol for difficult to recognize symbols" do
76
- MoneyHelper.money_to_text(30000, "AMD").should eql("AMD դր.30,000")
77
- MoneyHelper.money_to_text(30000, "BDT").should eql("BDT ৳30,000")
78
- MoneyHelper.money_to_text(30000, "BRL").should eql("BRL R$30.000")
79
- MoneyHelper.money_to_text(30000, "GMD").should eql("GMD D30,000")
80
- MoneyHelper.money_to_text(30000, "GEL").should eql("GEL ლ30,000")
81
- MoneyHelper.money_to_text(30000, "GHS").should eql("GHS ₵30,000")
82
- MoneyHelper.money_to_text(30000, "GTQ").should eql("GTQ Q30,000")
83
- MoneyHelper.money_to_text(30000, "HTG").should eql("HTG G30,000")
84
- MoneyHelper.money_to_text(30000, "IDR").should eql("IDR Rp30.000")
85
- MoneyHelper.money_to_text(30000, "ILS").should eql("ILS ₪30,000")
86
- MoneyHelper.money_to_text(30000, "INR").should eql("INR ₹30,000")
87
- MoneyHelper.money_to_text(30000, "KHR").should eql("KHR ៛30,000")
88
- MoneyHelper.money_to_text(30000, "KPW").should eql("KPW ₩30,000")
89
- MoneyHelper.money_to_text(30000, "LAK").should eql("LAK ₭30,000")
90
- MoneyHelper.money_to_text(30000, "MNT").should eql("MNT ₮30,000")
91
- MoneyHelper.money_to_text(30000, "NIO").should eql("NIO C$30,000")
92
- MoneyHelper.money_to_text(30000, "NGN").should eql("NGN ₦30,000")
93
- MoneyHelper.money_to_text(30000, "PGK").should eql("PGK K30,000")
94
- MoneyHelper.money_to_text(30000, "PHP").should eql("PHP ₱30,000")
95
- MoneyHelper.money_to_text(30000, "PYG").should eql("PYG ₲30,000")
96
- MoneyHelper.money_to_text(30000, "RUB").should eql("RUB р.30.000")
97
- MoneyHelper.money_to_text(30000, "THB").should eql("THB ฿30,000")
98
- MoneyHelper.money_to_text(30000, "TOP").should eql("TOP T$30,000")
99
- MoneyHelper.money_to_text(30000, "TMT").should eql("TMT m30,000")
100
- MoneyHelper.money_to_text(30000, "UAH").should eql("UAH ₴30,000")
101
- MoneyHelper.money_to_text(30000, "VND").should eql("VND ₫30.000")
102
- MoneyHelper.money_to_text(30000, "WST").should eql("WST T30,000")
103
- MoneyHelper.money_to_text(30000, "ZAR").should eql("ZAR R30,000")
76
+ expect(MoneyHelper.money_to_text(30000, "AMD")).to eql("AMD դր.30,000")
77
+ expect(MoneyHelper.money_to_text(30000, "BDT")).to eql("BDT ৳30,000")
78
+ expect(MoneyHelper.money_to_text(30000, "BRL")).to eql("BRL R$30.000")
79
+ expect(MoneyHelper.money_to_text(30000, "GMD")).to eql("GMD D30,000")
80
+ expect(MoneyHelper.money_to_text(30000, "GEL")).to eql("GEL ლ30,000")
81
+ expect(MoneyHelper.money_to_text(30000, "GHS")).to eql("GHS ₵30,000")
82
+ expect(MoneyHelper.money_to_text(30000, "GTQ")).to eql("GTQ Q30,000")
83
+ expect(MoneyHelper.money_to_text(30000, "HTG")).to eql("HTG G30,000")
84
+ expect(MoneyHelper.money_to_text(30000, "IDR")).to eql("IDR Rp30.000")
85
+ expect(MoneyHelper.money_to_text(30000, "ILS")).to eql("ILS ₪30,000")
86
+ expect(MoneyHelper.money_to_text(30000, "INR")).to eql("INR ₹30,000")
87
+ expect(MoneyHelper.money_to_text(30000, "KHR")).to eql("KHR ៛30,000")
88
+ expect(MoneyHelper.money_to_text(30000, "KPW")).to eql("KPW ₩30,000")
89
+ expect(MoneyHelper.money_to_text(30000, "LAK")).to eql("LAK ₭30,000")
90
+ expect(MoneyHelper.money_to_text(30000, "MNT")).to eql("MNT ₮30,000")
91
+ expect(MoneyHelper.money_to_text(30000, "NIO")).to eql("NIO C$30,000")
92
+ expect(MoneyHelper.money_to_text(30000, "NGN")).to eql("NGN ₦30,000")
93
+ expect(MoneyHelper.money_to_text(30000, "PGK")).to eql("PGK K30,000")
94
+ expect(MoneyHelper.money_to_text(30000, "PHP")).to eql("PHP ₱30,000")
95
+ expect(MoneyHelper.money_to_text(30000, "PYG")).to eql("PYG ₲30,000")
96
+ expect(MoneyHelper.money_to_text(30000, "RUB")).to eql("RUB 30.000")
97
+ expect(MoneyHelper.money_to_text(30000, "THB")).to eql("THB ฿30,000")
98
+ expect(MoneyHelper.money_to_text(30000, "TOP")).to eql("TOP T$30,000")
99
+ expect(MoneyHelper.money_to_text(30000, "TMT")).to eql("TMT T30,000")
100
+ expect(MoneyHelper.money_to_text(30000, "UAH")).to eql("UAH ₴30,000")
101
+ expect(MoneyHelper.money_to_text(30000, "VND")).to eql("VND ₫30.000")
102
+ expect(MoneyHelper.money_to_text(30000, "WST")).to eql("WST T30,000")
103
+ expect(MoneyHelper.money_to_text(30000, "ZAR")).to eql("ZAR R30,000")
104
104
  end
105
105
  it "includes only ISO code for currencies that don't have a symbol" do
106
- MoneyHelper.money_to_text(30000, "UZS").should eql("UZS 30,000")
106
+ expect(MoneyHelper.money_to_text(30000, "UZS")).to eql("UZS 30,000")
107
107
  end
108
108
  it "includes only ISO code for RTL symbols" do
109
- MoneyHelper.money_to_text(30000, "AFN").should eql("AFN 30,000")
110
- MoneyHelper.money_to_text(30000, "DZD").should eql("DZD 30,000")
111
- MoneyHelper.money_to_text(30000, "BHD").should eql("BHD 30,000")
112
- MoneyHelper.money_to_text(30000, "EGP").should eql("EGP 30,000")
113
- MoneyHelper.money_to_text(30000, "IRR").should eql("IRR 30,000")
114
- MoneyHelper.money_to_text(30000, "IQD").should eql("IQD 30,000")
115
- MoneyHelper.money_to_text(30000, "JOD").should eql("JOD 30,000")
116
- MoneyHelper.money_to_text(30000, "KWD").should eql("KWD 30,000")
117
- MoneyHelper.money_to_text(30000, "LBP").should eql("LBP 30,000")
118
- MoneyHelper.money_to_text(30000, "LYD").should eql("LYD 30,000")
119
- MoneyHelper.money_to_text(30000, "MAD").should eql("MAD 30,000")
120
- MoneyHelper.money_to_text(30000, "OMR").should eql("OMR 30,000")
121
- MoneyHelper.money_to_text(30000, "JOD").should eql("JOD 30,000")
122
- MoneyHelper.money_to_text(30000, "QAR").should eql("QAR 30,000")
123
- MoneyHelper.money_to_text(30000, "SAR").should eql("SAR 30,000")
124
- MoneyHelper.money_to_text(30000, "SYP").should eql("SYP 30,000")
125
- MoneyHelper.money_to_text(30000, "TND").should eql("TND 30,000")
126
- MoneyHelper.money_to_text(30000, "AED").should eql("AED 30,000")
127
- MoneyHelper.money_to_text(30000, "YER").should eql("YER 30,000")
109
+ expect(MoneyHelper.money_to_text(30000, "AFN")).to eql("AFN 30,000")
110
+ expect(MoneyHelper.money_to_text(30000, "DZD")).to eql("DZD 30,000")
111
+ expect(MoneyHelper.money_to_text(30000, "BHD")).to eql("BHD 30,000")
112
+ expect(MoneyHelper.money_to_text(30000, "EGP")).to eql("EGP 30,000")
113
+ expect(MoneyHelper.money_to_text(30000, "IRR")).to eql("IRR 30,000")
114
+ expect(MoneyHelper.money_to_text(30000, "IQD")).to eql("IQD 30,000")
115
+ expect(MoneyHelper.money_to_text(30000, "JOD")).to eql("JOD 30,000")
116
+ expect(MoneyHelper.money_to_text(30000, "KWD")).to eql("KWD 30,000")
117
+ expect(MoneyHelper.money_to_text(30000, "LBP")).to eql("LBP 30,000")
118
+ expect(MoneyHelper.money_to_text(30000, "LYD")).to eql("LYD 30,000")
119
+ expect(MoneyHelper.money_to_text(30000, "MAD")).to eql("MAD 30,000")
120
+ expect(MoneyHelper.money_to_text(30000, "OMR")).to eql("OMR 30,000")
121
+ expect(MoneyHelper.money_to_text(30000, "JOD")).to eql("JOD 30,000")
122
+ expect(MoneyHelper.money_to_text(30000, "QAR")).to eql("QAR 30,000")
123
+ expect(MoneyHelper.money_to_text(30000, "SAR")).to eql("SAR 30,000")
124
+ expect(MoneyHelper.money_to_text(30000, "SYP")).to eql("SYP 30,000")
125
+ expect(MoneyHelper.money_to_text(30000, "TND")).to eql("TND 30,000")
126
+ expect(MoneyHelper.money_to_text(30000, "AED")).to eql("AED 30,000")
127
+ expect(MoneyHelper.money_to_text(30000, "YER")).to eql("YER 30,000")
128
128
  end
129
129
  it "defaults to USD when an empty string or nil is passed as the currency" do
130
- MoneyHelper.money_to_text(30000, "").should eql("$30,000")
131
- MoneyHelper.money_to_text(30000, nil).should eql("$30,000")
130
+ expect(MoneyHelper.money_to_text(30000, "")).to eql("$30,000")
131
+ expect(MoneyHelper.money_to_text(30000, nil)).to eql("$30,000")
132
132
  end
133
133
  it "returns only the formatted numeral when number_only = true" do
134
- MoneyHelper.money_to_text(30000, "EUR", true).should eql("30.000")
135
- MoneyHelper.money_to_text(30000, "AUD", true).should eql("30,000")
136
- MoneyHelper.money_to_text(30000, "AMD", true).should eql("30,000")
137
- MoneyHelper.money_to_text(30000, "AFN", true).should eql("30,000")
134
+ expect(MoneyHelper.money_to_text(30000, "EUR", true)).to eql("30.000")
135
+ expect(MoneyHelper.money_to_text(30000, "AUD", true)).to eql("30,000")
136
+ expect(MoneyHelper.money_to_text(30000, "AMD", true)).to eql("30,000")
137
+ expect(MoneyHelper.money_to_text(30000, "AFN", true)).to eql("30,000")
138
138
  end
139
139
  it "returns nil if amount passed in is whitespace, empty string, or nil" do
140
- MoneyHelper.money_to_text(" ", "USD").should be_nil
141
- MoneyHelper.money_to_text("", "USD").should be_nil
142
- MoneyHelper.money_to_text(nil, "USD").should be_nil
140
+ expect(MoneyHelper.money_to_text(" ", "USD")).to be_nil
141
+ expect(MoneyHelper.money_to_text("", "USD")).to be_nil
142
+ expect(MoneyHelper.money_to_text(nil, "USD")).to be_nil
143
143
  end
144
144
  it "falls back to ISO code when currency can't be found" do
145
- MoneyHelper.money_to_text(10_000, "ITL").should eql("ITL 10,000")
146
- MoneyHelper.money_to_text(10_000, "ITL", true).should eql("10,000")
145
+ expect(MoneyHelper.money_to_text(10_000, "ITL")).to eql("ITL 10,000")
146
+ expect(MoneyHelper.money_to_text(10_000, "ITL", true)).to eql("10,000")
147
147
  end
148
148
  end
149
149
  describe "money_range_to_text" do
150
150
  it "includes no indicator for currency for the upper amount in range" do
151
- MoneyHelper.money_range_to_text(30000, 40000, "USD").should eql("$30,000 - 40,000")
152
- MoneyHelper.money_range_to_text(30000, 40000, "AUD").should eql("AUD $30,000 - 40,000")
153
- MoneyHelper.money_range_to_text(30000, 40000, "AMD").should eql("AMD դր.30,000 - 40,000")
154
- MoneyHelper.money_range_to_text(30000, 40000, "AFN").should eql("AFN 30,000 - 40,000")
151
+ expect(MoneyHelper.money_range_to_text(30000, 40000, "USD")).to eql("$30,000 - 40,000")
152
+ expect(MoneyHelper.money_range_to_text(30000, 40000, "AUD")).to eql("AUD $30,000 - 40,000")
153
+ expect(MoneyHelper.money_range_to_text(30000, 40000, "AMD")).to eql("AMD դր.30,000 - 40,000")
154
+ expect(MoneyHelper.money_range_to_text(30000, 40000, "AFN")).to eql("AFN 30,000 - 40,000")
155
155
  end
156
156
  it "uses the special range amount delimeter when supplied" do
157
- MoneyHelper.money_range_to_text(30000, 40000, "USD", "-").should eql("$30,000-40,000")
158
- MoneyHelper.money_range_to_text(30000, 40000, "AUD", "-").should eql("AUD $30,000-40,000")
159
- MoneyHelper.money_range_to_text(30000, 40000, "AMD", "-").should eql("AMD դր.30,000-40,000")
160
- MoneyHelper.money_range_to_text(30000, 40000, "AFN", "-").should eql("AFN 30,000-40,000")
157
+ expect(MoneyHelper.money_range_to_text(30000, 40000, "USD", "-")).to eql("$30,000-40,000")
158
+ expect(MoneyHelper.money_range_to_text(30000, 40000, "AUD", "-")).to eql("AUD $30,000-40,000")
159
+ expect(MoneyHelper.money_range_to_text(30000, 40000, "AMD", "-")).to eql("AMD դր.30,000-40,000")
160
+ expect(MoneyHelper.money_range_to_text(30000, 40000, "AFN", "-")).to eql("AFN 30,000-40,000")
161
161
  end
162
162
  it "prefixes the text 'Under ' when low amount not given" do
163
- MoneyHelper.money_range_to_text(nil, 40000, "USD").should eql("Under $40,000")
163
+ expect(MoneyHelper.money_range_to_text(nil, 40000, "USD")).to eql("Under $40,000")
164
164
  end
165
165
  it "appends the text ' and up' when high amount not given" do
166
- MoneyHelper.money_range_to_text(30000, nil, "USD").should eql("$30,000 and up")
166
+ expect(MoneyHelper.money_range_to_text(30000, nil, "USD")).to eql("$30,000 and up")
167
167
  end
168
168
  it "treats as a single price when low amount and high amount are identical" do
169
- MoneyHelper.money_range_to_text(30000, 30000, "USD").should eql("$30,000")
169
+ expect(MoneyHelper.money_range_to_text(30000, 30000, "USD")).to eql("$30,000")
170
170
  end
171
171
  it "returns nil when both amounts are nil" do
172
- MoneyHelper.money_range_to_text(nil, nil, "USD").should be_nil
172
+ expect(MoneyHelper.money_range_to_text(nil, nil, "USD")).to be_nil
173
173
  end
174
174
  it "falls back to ISO code when currency can't be found" do
175
- MoneyHelper.money_range_to_text(10_000, 20_000, "ITL").should eql("ITL 10,000 - 20,000")
175
+ expect(MoneyHelper.money_range_to_text(10_000, 20_000, "ITL")).to eql("ITL 10,000 - 20,000")
176
176
  end
177
177
  end
178
178
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sahil Yakhmi
@@ -9,50 +9,50 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-12 00:00:00.000000000 Z
12
+ date: 2015-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: money
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: '6.0'
20
+ version: '6.5'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ! '>='
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: '6.0'
27
+ version: '6.5'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activesupport
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: '3.0'
34
+ version: '4'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
- version: '3.0'
41
+ version: '4'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ! '>='
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: '3'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ! '>='
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: '3'
56
56
  description: A simple module to assist in formatting unambiguous prices and price
57
57
  ranges in international currencies in a Roman Script context.
58
58
  email: sahil@artsymail.net
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.1.10
85
+ rubygems_version: 2.4.6
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: MoneyHelper international price formatting utility