bigcartel-currency-locales 2.0.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +12 -11
  3. data/Appraisals +10 -2
  4. data/Rakefile +1 -6
  5. data/bigcartel-currency-locales.gemspec +2 -2
  6. data/gemfiles/rails_6.1.gemfile +7 -0
  7. data/gemfiles/rails_6.1.gemfile.lock +184 -0
  8. data/gemfiles/rails_6.gemfile +1 -1
  9. data/gemfiles/rails_6.gemfile.lock +6 -4
  10. data/gemfiles/rails_7.1.gemfile +7 -0
  11. data/gemfiles/rails_7.1.gemfile.lock +216 -0
  12. data/gemfiles/rails_7.gemfile +1 -1
  13. data/gemfiles/rails_7.gemfile.lock +69 -102
  14. data/lib/currency-locales/locales/ae.yml +26 -0
  15. data/lib/currency-locales/locales/bg.yml +22 -0
  16. data/lib/currency-locales/locales/cs.yml +0 -0
  17. data/lib/currency-locales/locales/da.yml +1 -1
  18. data/lib/currency-locales/locales/en-AU.yml +1 -1
  19. data/lib/currency-locales/locales/en-GB.yml +1 -1
  20. data/lib/currency-locales/locales/en-IN.yml +2 -2
  21. data/lib/currency-locales/locales/en-PH.yml +1 -2
  22. data/lib/currency-locales/locales/en-US.yml +1 -1
  23. data/lib/currency-locales/locales/es-MX.yml +1 -1
  24. data/lib/currency-locales/locales/eu.yml +0 -0
  25. data/lib/currency-locales/locales/gsw-CH.yml +1 -1
  26. data/lib/currency-locales/locales/hr.yml +22 -0
  27. data/lib/currency-locales/locales/hu.yml +24 -24
  28. data/lib/currency-locales/locales/il.yml +0 -0
  29. data/lib/currency-locales/locales/ja.yml +1 -1
  30. data/lib/currency-locales/locales/ms-MY.yml +1 -1
  31. data/lib/currency-locales/locales/nb.yml +10 -6
  32. data/lib/currency-locales/locales/pl.yml +1 -2
  33. data/lib/currency-locales/locales/pt-BR.yml +1 -1
  34. data/lib/currency-locales/locales/ro.yml +26 -0
  35. data/lib/currency-locales/locales/sv-SE.yml +2 -2
  36. data/lib/currency-locales/locales/th.yml +1 -1
  37. data/lib/currency-locales/locales/tr.yml +1 -1
  38. data/lib/currency-locales/locales/zh-TW.yml +1 -1
  39. data/lib/currency-locales/version.rb +1 -1
  40. data/spec/integration/currency_locales_spec.rb +51 -422
  41. data/spec/spec_helper.rb +1 -1
  42. metadata +16 -8
@@ -1,441 +1,70 @@
1
- # encoding: utf-8
2
-
3
1
  require 'spec_helper'
4
2
 
5
- describe "CurrencyLocales" do
6
- let(:small_amount) { 9.99 }
7
- let(:small_currency) { number_to_currency(small_amount) }
8
- let(:small_precision) { number_with_precision(small_amount) }
9
-
10
- let(:big_amount) { 9999.99 }
11
- let(:big_currency) { number_to_currency(big_amount) }
12
- let(:big_precision) { number_with_precision(big_amount) }
13
-
14
- def number_to_currency(number)
15
- ActionController::Base.helpers.number_to_currency(number, :locale => locale)
16
- end
17
-
18
- def number_with_precision(number)
19
- ActionController::Base.helpers.number_with_precision(number, :locale => locale)
20
- end
21
-
22
- describe "cs" do
23
- let(:locale) { 'cs' }
24
-
25
- it "should translate the small amount to currency" do
26
- small_currency.should == '9,99Kč'
27
- end
28
-
29
- it "should translate the big amount to currency" do
30
- big_currency.should == '9999,99Kč'
31
- end
32
-
33
- it "should translate the small amount with precision" do
34
- small_precision.should == '9,99'
35
- end
36
-
37
- it "should translate the big amount with precision" do
38
- big_precision.should == '9999,99'
39
- end
40
- end
41
-
42
- describe "da" do
43
- let(:locale) { 'da' }
44
-
45
- it "should translate the small amount to currency" do
46
- small_currency.should == 'kr9,99'
47
- end
48
-
49
- it "should translate the big amount to currency" do
50
- big_currency.should == 'kr9.999,99'
51
- end
52
-
53
- it "should translate the small amount with precision" do
54
- small_precision.should == '9,99'
55
- end
56
-
57
- it "should translate the big amount with precision" do
58
- big_precision.should == '9.999,99'
59
- end
60
- end
61
-
62
- describe "en-AU" do
63
- let(:locale) { 'en-AU' }
64
-
65
- it "should translate the small amount to currency" do
66
- small_currency.should == '$9.99'
67
- end
68
-
69
- it "should translate the big amount to currency" do
70
- big_currency.should == '$9,999.99'
71
- end
72
-
73
- it "should translate the small amount with precision" do
74
- small_precision.should == '9.99'
75
- end
76
-
77
- it "should translate the big amount with precision" do
78
- big_precision.should == '9,999.99'
79
- end
80
- end
81
-
82
- describe "en-GB" do
83
- let(:locale) { 'en-GB' }
84
-
85
- it "should translate the small amount to currency" do
86
- small_currency.should == '£9.99'
87
- end
88
-
89
- it "should translate the big amount to currency" do
90
- big_currency.should == '£9,999.99'
91
- end
92
-
93
- it "should translate the small amount with precision" do
94
- small_precision.should == '9.99'
95
- end
96
-
97
- it "should translate the big amount with precision" do
98
- big_precision.should == '9,999.99'
99
- end
100
- end
101
-
102
- describe "en-IN" do
103
- let(:locale) { 'en-IN' }
3
+ shared_examples_for "locale" do |locale_code, small_currency, big_currency, small_precision, big_precision|
4
+ let(:locale) { locale_code }
104
5
 
105
- it "should translate the small amount to currency" do
106
- small_currency.should == '₹9.99'
107
- end
108
-
109
- it "should translate the big amount to currency" do
110
- big_currency.should == '₹9,999.99'
111
- end
112
-
113
- it "should translate the small amount with precision" do
114
- small_precision.should == '9.99'
115
- end
116
-
117
- it "should translate the big amount with precision" do
118
- big_precision.should == '9999.99'
119
- end
120
- end
121
-
122
- describe "en-PH" do
123
- let(:locale) { 'en-PH' }
124
-
125
- it "should translate the small amount to currency" do
126
- small_currency.should == '₱9.99'
127
- end
128
-
129
- it "should translate the big amount to currency" do
130
- big_currency.should == '₱9,999.99'
131
- end
132
-
133
- it "should translate the small amount with precision" do
134
- small_precision.should == '9.99'
135
- end
136
-
137
- it "should translate the big amount with precision" do
138
- big_precision.should == '9,999.99'
139
- end
140
- end
141
-
142
- describe "es-MX" do
143
- let(:locale) { 'es-MX' }
144
-
145
- it "should translate the small amount to currency" do
146
- small_currency.should == '$9.99'
147
- end
148
-
149
- it "should translate the big amount to currency" do
150
- big_currency.should == '$9,999.99'
151
- end
152
-
153
- it "should translate the small amount with precision" do
154
- small_precision.should == '9.99'
155
- end
156
-
157
- it "should translate the big amount with precision" do
158
- big_precision.should == '9,999.99'
159
- end
6
+ it "should translate the small amount to currency for locale #{locale_code}" do
7
+ expect(number_to_currency(small_amount)).to eq(small_currency)
160
8
  end
161
9
 
162
- describe "en-US" do
163
- let(:locale) { 'en-US' }
164
-
165
- it "should translate the small amount to currency" do
166
- small_currency.should == '$9.99'
167
- end
168
-
169
- it "should translate the big amount to currency" do
170
- big_currency.should == '$9,999.99'
171
- end
172
-
173
- it "should translate the small amount with precision" do
174
- small_precision.should == '9.99'
175
- end
176
-
177
- it "should translate the big amount with precision" do
178
- big_precision.should == '9,999.99'
179
- end
10
+ it "should translate the big amount to currency for locale #{locale_code}" do
11
+ expect(number_to_currency(big_amount)).to eq(big_currency)
180
12
  end
181
13
 
182
- describe "eu" do
183
- let(:locale) { 'eu' }
184
-
185
- it "should translate the small amount to currency" do
186
- small_currency.should == '€9.99'
187
- end
188
-
189
- it "should translate the big amount to currency" do
190
- big_currency.should == '€9,999.99'
191
- end
192
-
193
- it "should translate the small amount with precision" do
194
- small_precision.should == '9.99'
195
- end
196
-
197
- it "should translate the big amount with precision" do
198
- big_precision.should == '9,999.99'
199
- end
14
+ it "should translate the small amount with precision for locale #{locale_code}" do
15
+ expect(number_with_precision(small_amount)).to eq(small_precision)
200
16
  end
201
17
 
202
- describe "gsw-CH" do
203
- let(:locale) { 'gsw-CH' }
204
-
205
- it "should translate the small amount to currency" do
206
- small_currency.should == 'CHF9.99'
207
- end
208
-
209
- it "should translate the big amount to currency" do
210
- big_currency.should == 'CHF9,999.99'
211
- end
212
-
213
- it "should translate the small amount with precision" do
214
- small_precision.should == '9.99'
215
- end
216
-
217
- it "should translate the big amount with precision" do
218
- big_precision.should == '9,999.99'
219
- end
18
+ it "should translate the big amount with precision for locale #{locale_code}" do
19
+ expect(number_with_precision(big_amount)).to eq(big_precision)
220
20
  end
21
+ end
221
22
 
222
- describe "hu" do
223
- let(:locale) { 'hu' }
224
-
225
- it "should translate the small amount to currency" do
226
- small_currency.should == '10Ft'
227
- end
228
-
229
- it "should translate the big amount to currency" do
230
- big_currency.should == '10000Ft'
231
- end
232
-
233
- it "should translate the small amount with precision" do
234
- small_precision.should == '9,99'
235
- end
236
-
237
- it "should translate the big amount with precision" do
238
- big_precision.should == '9999,99'
239
- end
240
- end
241
-
242
- describe "il" do
243
- let(:locale) { 'il' }
244
-
245
- it "should translate the small amount to currency" do
246
- small_currency.should == '₪9.99'
247
- end
248
-
249
- it "should translate the big amount to currency" do
250
- big_currency.should == '₪9,999.99'
251
- end
252
-
253
- it "should translate the small amount with precision" do
254
- small_precision.should == '9.99'
255
- end
256
-
257
- it "should translate the big amount with precision" do
258
- big_precision.should == '9,999.99'
259
- end
260
- end
261
-
262
- describe "ja" do
263
- let(:locale) { 'ja' }
264
-
265
- it "should translate the small amount to currency" do
266
- small_currency.should == '¥10'
267
- end
268
-
269
- it "should translate the big amount to currency" do
270
- big_currency.should == '¥10,000'
271
- end
272
-
273
- it "should translate the small amount with precision" do
274
- small_precision.should == '9.99'
275
- end
276
-
277
- it "should translate the big amount with precision" do
278
- big_precision.should == '9,999.99'
279
- end
280
- end
281
-
282
- describe "ms-MY" do
283
- let(:locale) { 'ms-MY' }
284
-
285
- it "should translate the small amount to currency" do
286
- small_currency.should == 'RM9.99'
287
- end
288
-
289
- it "should translate the big amount to currency" do
290
- big_currency.should == 'RM9,999.99'
291
- end
292
-
293
- it "should translate the small amount with precision" do
294
- small_precision.should == '9.99'
295
- end
296
-
297
- it "should translate the big amount with precision" do
298
- big_precision.should == '9,999.99'
299
- end
300
- end
301
-
302
- describe "nb" do
303
- let(:locale) { 'nb' }
304
-
305
- it "should translate the small amount to currency" do
306
- small_currency.should == '9,99kr'
307
- end
308
-
309
- it "should translate the big amount to currency" do
310
- big_currency.should == '9999,99kr'
311
- end
312
-
313
- it "should translate the small amount with precision" do
314
- small_precision.should == '9,99'
315
- end
316
-
317
- it "should translate the big amount with precision" do
318
- big_precision.should == '9999,99'
319
- end
320
- end
321
-
322
- describe "pl" do
323
- let(:locale) { 'pl' }
324
-
325
- it "should translate the small amount to currency" do
326
- small_currency.should == '9,99zł'
327
- end
328
-
329
- it "should translate the big amount to currency" do
330
- big_currency.should == '9999,99zł'
331
- end
332
-
333
- it "should translate the small amount with precision" do
334
- small_precision.should == '9,99'
335
- end
336
-
337
- it "should translate the big amount with precision" do
338
- big_precision.should == '9999,99'
339
- end
340
- end
341
-
342
- describe "pt-BR" do
343
- let(:locale) { 'pt-BR' }
344
-
345
- it "should translate the small amount to currency" do
346
- small_currency.should == 'R$9,99'
347
- end
348
-
349
- it "should translate the big amount to currency" do
350
- big_currency.should == 'R$9.999,99'
351
- end
352
-
353
- it "should translate the small amount with precision" do
354
- small_precision.should == '9,99'
355
- end
356
-
357
- it "should translate the big amount with precision" do
358
- big_precision.should == '9.999,99'
359
- end
360
- end
361
-
362
- describe "sv-SE" do
363
- let(:locale) { 'sv-SE' }
364
-
365
- it "should translate the small amount to currency" do
366
- small_currency.should == '9,99kr'
367
- end
368
-
369
- it "should translate the big amount to currency" do
370
- big_currency.should == '9999,99kr'
371
- end
372
-
373
- it "should translate the small amount with precision" do
374
- small_precision.should == '9,99'
375
- end
376
-
377
- it "should translate the big amount with precision" do
378
- big_precision.should == '9999,99'
379
- end
380
- end
381
-
382
- describe "th" do
383
- let(:locale) { 'th' }
384
-
385
- it "should translate the small amount to currency" do
386
- small_currency.should == '9.99฿'
387
- end
388
-
389
- it "should translate the big amount to currency" do
390
- big_currency.should == '9,999.99฿'
391
- end
392
-
393
- it "should translate the small amount with precision" do
394
- small_precision.should == '9.99'
395
- end
23
+ describe "CurrencyLocales" do
24
+ let(:small_amount) { 9.99 }
25
+ let(:big_amount) { 9999.99 }
396
26
 
397
- it "should translate the big amount with precision" do
398
- big_precision.should == '9,999.99'
399
- end
27
+ def number_to_currency(number)
28
+ ActionController::Base.helpers.number_to_currency(number, :locale => locale)
400
29
  end
401
30
 
402
- describe "tr" do
403
- let(:locale) { 'tr' }
404
-
405
- it "should translate the small amount to currency" do
406
- small_currency.should == '9,99 ₺'
407
- end
408
-
409
- it "should translate the big amount to currency" do
410
- big_currency.should == '9.999,99 ₺'
411
- end
412
-
413
- it "should translate the small amount with precision" do
414
- small_precision.should == '9,99'
415
- end
416
-
417
- it "should translate the big amount with precision" do
418
- big_precision.should == '9.999,99'
419
- end
31
+ def number_with_precision(number)
32
+ ActionController::Base.helpers.number_with_precision(number, :locale => locale)
420
33
  end
421
34
 
422
- describe "zh-TW" do
423
- let(:locale) { 'zh-TW' }
424
-
425
- it "should translate the small amount to currency" do
426
- small_currency.should == 'NT$9.99'
427
- end
428
-
429
- it "should translate the big amount to currency" do
430
- big_currency.should == 'NT$9,999.99'
431
- end
432
-
433
- it "should translate the small amount with precision" do
434
- small_precision.should == '9.99'
435
- end
436
-
437
- it "should translate the big amount with precision" do
438
- big_precision.should == '9,999.99'
35
+ locales = {
36
+ 'ae' => ['AED 9.99', 'AED 9,999.99', '9.99', '9,999.99'],
37
+ 'bg' => ['9,99лв', '9 999,99лв', '9,99', '9 999,99'],
38
+ 'cs' => ['9,99Kč', '9999,99Kč', '9,99', '9999,99'],
39
+ 'da' => ['9,99kr', '9.999,99kr', '9,99', '9.999,99'],
40
+ 'en-AU' => ['$9.99', '$9,999.99', '9.99', '9,999.99'],
41
+ 'en-GB' => ['£9.99', '£9,999.99', '9.99', '9,999.99'],
42
+ 'en-IN' => ['₹9.99', '₹9,999.99', '9.99', '9,999.99'],
43
+ 'en-PH' => ['₱9.99', '₱9,999.99', '9.99', '9,999.99'],
44
+ 'en-US' => ['$9.99', '$9,999.99', '9.99', '9,999.99'],
45
+ 'es-MX' => ['$9.99', '$9,999.99', '9.99', '9,999.99'],
46
+ 'eu' => ['€9.99', '€9,999.99', '9.99', '9,999.99'],
47
+ 'gsw-CH' => ['CHF9.99', 'CHF9,999.99', '9.99', '9,999.99'],
48
+ 'hr' => ['9,99 kn', '9.999,99 kn', '9,99', '9.999,99'],
49
+ 'hu' => ['10Ft', '10000Ft', '9,99', '9999,99'],
50
+ 'il' => ['₪9.99', '₪9,999.99', '9.99', '9,999.99'],
51
+ 'ja' => ['¥10', '¥10,000', '9.99', '9,999.99'],
52
+ 'ms-MY' => ['RM9.99', 'RM9,999.99', '9.99', '9,999.99'],
53
+ 'nb' => ['9,99 kr', '9999,99 kr', '9,99', '9999,99'],
54
+ 'pl' => ['9,99 zł', '9999,99 zł', '9,99', '9999,99'],
55
+ 'pt-BR' => ['R$9,99', 'R$9.999,99', '9,99', '9.999,99'],
56
+ 'ro' => ['9,99 lei', '9.999,99 lei', '9,99', '9.999,99'],
57
+ 'sv-SE' => ['9,99 kr', '9999,99 kr', '9,99', '9999,99'],
58
+ 'th' => ['฿9.99', '฿9,999.99', '9.99', '9,999.99'],
59
+ 'tr' => ['₺9,99', '₺9.999,99', '9,99', '9.999,99'],
60
+ 'zh-TW' => ['NT$9.99', 'NT$9,999.99', '9.99', '9,999.99'],
61
+ }
62
+
63
+ sorted_locales = locales.sort_by { |locale, _| locale }.to_h
64
+
65
+ sorted_locales.each do |locale, values|
66
+ describe "locale #{locale}" do
67
+ it_behaves_like "locale", locale, *values
439
68
  end
440
69
  end
441
70
  end
data/spec/spec_helper.rb CHANGED
@@ -12,6 +12,6 @@ RSpec.configure do |config|
12
12
  config.fail_fast = true
13
13
 
14
14
  config.expect_with(:rspec) do |c|
15
- c.syntax = :should
15
+ c.syntax = [:should, :expect]
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigcartel-currency-locales
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Big Cartel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-19 00:00:00.000000000 Z
11
+ date: 2024-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 6.0.6.1
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 6.0.6.1
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '0'
55
55
  description: Common locale data for Rails i18n of Big Cartel's supported currencies.
56
56
  email: dev@bigcartel.com
57
57
  executables: []
@@ -67,11 +67,17 @@ files:
67
67
  - Rakefile
68
68
  - bigcartel-currency-locales.gemspec
69
69
  - gemfiles/.bundle/config
70
+ - gemfiles/rails_6.1.gemfile
71
+ - gemfiles/rails_6.1.gemfile.lock
70
72
  - gemfiles/rails_6.gemfile
71
73
  - gemfiles/rails_6.gemfile.lock
74
+ - gemfiles/rails_7.1.gemfile
75
+ - gemfiles/rails_7.1.gemfile.lock
72
76
  - gemfiles/rails_7.gemfile
73
77
  - gemfiles/rails_7.gemfile.lock
74
78
  - lib/bigcartel-currency-locales.rb
79
+ - lib/currency-locales/locales/ae.yml
80
+ - lib/currency-locales/locales/bg.yml
75
81
  - lib/currency-locales/locales/cs.yml
76
82
  - lib/currency-locales/locales/da.yml
77
83
  - lib/currency-locales/locales/en-AU.yml
@@ -82,6 +88,7 @@ files:
82
88
  - lib/currency-locales/locales/es-MX.yml
83
89
  - lib/currency-locales/locales/eu.yml
84
90
  - lib/currency-locales/locales/gsw-CH.yml
91
+ - lib/currency-locales/locales/hr.yml
85
92
  - lib/currency-locales/locales/hu.yml
86
93
  - lib/currency-locales/locales/il.yml
87
94
  - lib/currency-locales/locales/ja.yml
@@ -89,6 +96,7 @@ files:
89
96
  - lib/currency-locales/locales/nb.yml
90
97
  - lib/currency-locales/locales/pl.yml
91
98
  - lib/currency-locales/locales/pt-BR.yml
99
+ - lib/currency-locales/locales/ro.yml
92
100
  - lib/currency-locales/locales/sv-SE.yml
93
101
  - lib/currency-locales/locales/th.yml
94
102
  - lib/currency-locales/locales/tr.yml