humanize 1.8.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Humanize, "az locale" do
4
+ before do
5
+ Humanize.configure do |config|
6
+ config.default_locale = :az
7
+ end
8
+ end
9
+
10
+ tests = [
11
+ [8.15, 'səkkiz vergül bir beş'],
12
+ [1002, 'min iki'],
13
+ [2001, 'iki min bir'],
14
+ [10_000, 'on min']
15
+ ]
16
+
17
+ tests.each do |num, output|
18
+ it "#{num} equals #{output}" do
19
+ expect(num.humanize).to eql(output)
20
+ end
21
+ end
22
+
23
+ context 'decimals: number' do
24
+ it 'returns the decimals as whole numbers' do
25
+ num = 8.15
26
+ expect(num.humanize(decimals_as: :number)).to eq('səkkiz vergül on beş')
27
+ end
28
+ end
29
+
30
+ describe 'when called on conceptual number' do
31
+ it 'reads correctly' do
32
+ inf = Float::INFINITY
33
+ neg_inf = -inf
34
+ nan = inf + neg_inf
35
+
36
+ expect(inf.humanize).to eql('sonsuz')
37
+ expect(neg_inf.humanize).to eql('mənfi sonsuz')
38
+ expect(nan.humanize).to eql('undefined')
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Humanize, "de locale" do
4
+ before do
5
+ Humanize.configure do |config|
6
+ config.default_locale = :de
7
+ end
8
+ end
9
+
10
+ tests = [
11
+ [8.15, 'Acht Punkt Eins Fünf'],
12
+ [1002, 'Eins Tausend und Zwei'],
13
+ [2001, 'Zwei Tausend und Eins'],
14
+ [10_000, 'Zehn Tausend']
15
+ ]
16
+
17
+ tests.each do |num, output|
18
+ it "#{num} equals #{output}" do
19
+ expect(num.humanize).to eql(output)
20
+ end
21
+ end
22
+
23
+ context 'decimals: number' do
24
+ it 'returns the decimals as whole numbers' do
25
+ num = 8.15
26
+ expect(num.humanize(decimals_as: :number)).to eq('Acht Punkt Fünfzehn')
27
+ end
28
+ end
29
+
30
+ describe 'when called on conceptual number' do
31
+ it 'reads correctly' do
32
+ inf = Float::INFINITY
33
+ neg_inf = -inf
34
+ nan = inf + neg_inf
35
+
36
+ expect(inf.humanize).to eql('Unendlich')
37
+ expect(neg_inf.humanize).to eql('negativ Unendlich')
38
+ expect(nan.humanize).to eql('Undefiniert')
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,112 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Humanize, "en locale" do
4
+ # rubocop:disable Metrics/LineLength
5
+ en_tests = [
6
+ [-1, "negative one"],
7
+ [-0.042, "negative zero point zero four two"],
8
+ [-0.00003345, "negative zero point zero zero zero zero three three four five"],
9
+ [-0.0000017854, "negative zero point zero zero zero zero zero one seven eight five four"],
10
+ [0.000000123, "zero point zero zero zero zero zero zero one two three"],
11
+ [0, "zero"],
12
+ [8.15, "eight point one five"],
13
+ [8.000015, "eight point zero zero zero zero one five"],
14
+ [8, "eight"],
15
+ [11, "eleven"],
16
+ [21, "twenty-one"],
17
+ [99, "ninety-nine"],
18
+ [100, "one hundred"],
19
+ [101, "one hundred and one"],
20
+ [111, "one hundred and eleven"],
21
+ [121, "one hundred and twenty-one"],
22
+ [1079, "one thousand and seventy-nine"],
23
+ [10_000, "ten thousand"],
24
+ [10_079, "ten thousand and seventy-nine"],
25
+ [235_409, "two hundred and thirty-five thousand, four hundred and nine"],
26
+ [1_007_310, "one million, seven thousand, three hundred and ten"],
27
+ [21_007_310, "twenty-one million, seven thousand, three hundred and ten"],
28
+ [321_007_310, "three hundred and twenty-one million, seven thousand, three hundred and ten"],
29
+ [4_321_007_310, "four billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
30
+ [14_321_007_310, "fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
31
+ [514_321_007_310, "five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
32
+ [6_514_321_007_310, "six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
33
+ [76_514_321_007_310, "seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
34
+ [176_514_321_007_310, "one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
35
+ [2_176_514_321_007_310, "two quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
36
+ [12_176_514_321_007_310, "twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
37
+ [112_176_514_321_007_310, "one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
38
+ [1_112_176_514_321_007_310, "one quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
39
+ [11_112_176_514_321_007_310, "eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
40
+ [111_112_176_514_321_007_310, "one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
41
+ [1_111_112_176_514_321_007_310, "one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
42
+ [21_111_112_176_514_321_007_310, "twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
43
+ [221_111_112_176_514_321_007_310, "two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
44
+ [3_221_111_112_176_514_321_007_310, "three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
45
+ [33_221_111_112_176_514_321_007_310, "thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
46
+ [333_221_111_112_176_514_321_007_310, "three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
47
+ [4_333_221_111_112_176_514_321_007_310, "four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
48
+ [44_333_221_111_112_176_514_321_007_310, "forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
49
+ [444_333_221_111_112_176_514_321_007_310, "four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
50
+ [5_444_333_221_111_112_176_514_321_007_310, "five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
51
+ [55_444_333_221_111_112_176_514_321_007_310, "fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
52
+ [555_444_333_221_111_112_176_514_321_007_310, "five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
53
+ [6_555_444_333_221_111_112_176_514_321_007_310, "six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
54
+ [66_555_444_333_221_111_112_176_514_321_007_310, "sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
55
+ [666_555_444_333_221_111_112_176_514_321_007_310, "six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
56
+ [7_666_555_444_333_221_111_112_176_514_321_007_310, "seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
57
+ [77_666_555_444_333_221_111_112_176_514_321_007_310, "seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
58
+ [777_666_555_444_333_221_111_112_176_514_321_007_310, "seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
59
+ [9_777_666_555_444_333_221_111_112_176_514_321_007_310, "nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
60
+ [99_777_666_555_444_333_221_111_112_176_514_321_007_310, "ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
61
+ [999_777_666_555_444_333_221_111_112_176_514_321_007_310, "nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
62
+ [1_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "one tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
63
+ [11_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
64
+ [111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
65
+ [2_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
66
+ [22_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
67
+ [3_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
68
+ [33_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
69
+ [333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
70
+ [4_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
71
+ [44_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
72
+ [444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
73
+ [5_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
74
+ [55_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
75
+ [555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
76
+ [6_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
77
+ [66_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
78
+ [666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
79
+ [7_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
80
+ [77_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
81
+ [777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
82
+ [9_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
83
+ [99_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
84
+ [999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
85
+ [1_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "one unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
86
+ [11_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
87
+ [111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
88
+ [2_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
89
+ [22_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
90
+ [222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "two hundred and twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
91
+ [3_222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "three trevigintillion, two hundred and twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
92
+ [33_222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "thirty-three trevigintillion, two hundred and twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
93
+ [333_222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "three hundred and thirty-three trevigintillion, two hundred and twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
94
+ [4_333_222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "four quattuortillion, three hundred and thirty-three trevigintillion, two hundred and twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
95
+ [44_333_222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "forty-four quattuortillion, three hundred and thirty-three trevigintillion, two hundred and twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
96
+ [444_333_222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "four hundred and forty-four quattuortillion, three hundred and thirty-three trevigintillion, two hundred and twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"],
97
+ [444_333_222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310_444_333_222_111_999_777_666_555_444_333_222_111_999_777_666_555_444_333_221_111_112_176_514_321_007_310, "four hundred and forty-four quinquagintillion, three hundred and thirty-three novenquadragintillion, two hundred and twenty-two octoquadragintillion, one hundred and eleven septenquadragintillion, nine hundred and ninety-nine sesquadragintillion, seven hundred and seventy-seven quinquadragintillion, six hundred and sixty-six quattuorquadragintillion, five hundred and fifty-five trequadragintillion, four hundred and forty-four duoquadragintillion, three hundred and thirty-three unquadragintillion, two hundred and twenty-two quadragintillion, one hundred and eleven novemtrigintillion, nine hundred and ninety-nine octotrigintillion, seven hundred and seventy-seven septentrigintillion, six hundred and sixty-six sextrigintillion, five hundred and fifty-five quintrigintillion, four hundred and forty-four quattuortrigintillion, three hundred and thirty-three trestrigintillion, two hundred and twenty-one duotrigintillion, one hundred and eleven untrigintillion, one hundred and twelve trigintillion, one hundred and seventy-six novemvigintillion, five hundred and fourteen octovigintillion, three hundred and twenty-one septenvigintillion, seven sexvigintillion, three hundred and ten quinvigintillion, four hundred and forty-four quattuortillion, three hundred and thirty-three trevigintillion, two hundred and twenty-two duovigintillion, one hundred and eleven unvigintillion, nine hundred and ninety-nine vigintillion, seven hundred and seventy-seven novemdecillion, six hundred and sixty-six octodecillion, five hundred and fifty-five septendecillion, four hundred and forty-four sexdecillion, three hundred and thirty-three quindecillion, two hundred and twenty-two quattuordecillion, one hundred and eleven tredecillion, nine hundred and ninety-nine duodecillion, seven hundred and seventy-seven undecillion, six hundred and sixty-six decillion, five hundred and fifty-five nonillion, four hundred and forty-four octillion, three hundred and thirty-three septillion, two hundred and twenty-one sextillion, one hundred and eleven quintillion, one hundred and twelve quadrillion, one hundred and seventy-six trillion, five hundred and fourteen billion, three hundred and twenty-one million, seven thousand, three hundred and ten"]
98
+ ]
99
+ # rubocop:enable Metrics/LineLength
100
+
101
+ en_tests.each do |num, output|
102
+ it "#{num} is equal to #{output}" do
103
+ expect(num.humanize).to eq(output)
104
+ end
105
+ end
106
+
107
+ describe 'when called on bigdecimal' do
108
+ it 'reads correctly' do
109
+ expect(BigDecimal(en_tests.last.first).humanize).to eql(en_tests.last.last)
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Humanize, "fr locale" do
4
+ before do
5
+ Humanize.configure do |config|
6
+ config.default_locale = :fr
7
+ end
8
+ end
9
+
10
+ tests = [
11
+ [8.15, 'huit virgule un cinq'],
12
+ [1002, 'mille deux'],
13
+ [2001, 'deux mille un'],
14
+ [10_000, 'dix mille']
15
+ ]
16
+
17
+ tests.each do |num, output|
18
+ it "#{num} equals #{output}" do
19
+ expect(num.humanize).to eql(output)
20
+ end
21
+ end
22
+
23
+ context 'decimals: number' do
24
+ it 'returns the decimals as whole numbers' do
25
+ num = 8.15
26
+ expect(num.humanize(decimals_as: :number)).to eq('huit virgule quinze')
27
+ end
28
+ end
29
+
30
+ describe 'when called on conceptual number' do
31
+ it 'reads correctly' do
32
+ inf = Float::INFINITY
33
+ neg_inf = -inf
34
+ nan = inf + neg_inf
35
+
36
+ expect(inf.humanize).to eql('infini')
37
+ expect(neg_inf.humanize).to eql('négatif infini')
38
+ expect(nan.humanize).to eql('indéfini')
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Humanize, "id locale" do
4
+ before do
5
+ Humanize.configure do |config|
6
+ config.default_locale = :id
7
+ end
8
+ end
9
+
10
+ tests = [
11
+ [8.15, 'delapan koma satu lima'],
12
+ [1002, 'seribu dua'],
13
+ [2001, 'dua ribu satu'],
14
+ [10_000, 'sepuluh ribu']
15
+ ]
16
+
17
+ tests.each do |num, output|
18
+ it "#{num} equals #{output}" do
19
+ expect(num.humanize).to eql(output)
20
+ end
21
+ end
22
+
23
+ context 'decimals: number' do
24
+ it 'returns the decimals as whole numbers' do
25
+ num = 8.15
26
+ expect(num.humanize(decimals_as: :number)).to eq('delapan koma lima belas')
27
+ end
28
+ end
29
+
30
+ describe 'when called on conceptual number' do
31
+ it 'reads correctly' do
32
+ inf = Float::INFINITY
33
+ neg_inf = -inf
34
+ nan = inf + neg_inf
35
+
36
+ expect(inf.humanize).to eql('tak terhingga')
37
+ expect(neg_inf.humanize).to eql('minus tak terhingga')
38
+ expect(nan.humanize).to eql('tak terdefinisi')
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Humanize, "th locale" do
4
+ before do
5
+ Humanize.configure do |config|
6
+ config.default_locale = :th
7
+ end
8
+ end
9
+
10
+ tests = [
11
+ [8.15, 'แปด จุด หนึ่ง ห้า'],
12
+ [1002, 'หนึ่ง พัน และ สอง'],
13
+ [2001, 'สอง พัน และ หนึ่ง'],
14
+ [10_000, 'หนึ่ง หมื่น']
15
+ ]
16
+
17
+ tests.each do |num, output|
18
+ it "#{num} equals #{output}" do
19
+ expect(num.humanize).to eql(output)
20
+ end
21
+ end
22
+
23
+ context 'decimals: number' do
24
+ it 'returns the decimals as whole numbers' do
25
+ num = 8.15
26
+ expect(num.humanize(decimals_as: :number)).to eq('แปด จุด สิบห้า')
27
+ end
28
+ end
29
+
30
+ describe 'when called on conceptual number' do
31
+ it 'reads correctly' do
32
+ inf = Float::INFINITY
33
+ neg_inf = -inf
34
+ nan = inf + neg_inf
35
+
36
+ expect(inf.humanize).to eql('ความไม่มีที่สิ้นสุด')
37
+ expect(neg_inf.humanize).to eql('เชิงลบ ความไม่มีที่สิ้นสุด')
38
+ expect(nan.humanize).to eql('ไม่ได้กำหนด')
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Humanize, "tr locale" do
4
+ before do
5
+ Humanize.configure do |config|
6
+ config.default_locale = :tr
7
+ end
8
+ end
9
+
10
+ tests = [
11
+ [8.15, 'sekiz virgül bir beş'],
12
+ [1002, 'bin iki'],
13
+ [2001, 'iki bin bir'],
14
+ [10_000, 'on bin']
15
+ ]
16
+
17
+ tests.each do |num, output|
18
+ it "#{num} equals #{output}" do
19
+ expect(num.humanize).to eql(output)
20
+ end
21
+ end
22
+
23
+ context 'decimals: number' do
24
+ it 'returns the decimals as whole numbers' do
25
+ num = 8.15
26
+ expect(num.humanize(decimals_as: :number)).to eq('sekiz virgül on beş')
27
+ end
28
+ end
29
+
30
+ describe 'when called on conceptual number' do
31
+ it 'reads correctly' do
32
+ inf = Float::INFINITY
33
+ neg_inf = -inf
34
+ nan = inf + neg_inf
35
+
36
+ expect(inf.humanize).to eql('sonsuz')
37
+ expect(neg_inf.humanize).to eql('eksi sonsuz')
38
+ expect(nan.humanize).to eql('tanımsız')
39
+ end
40
+ end
41
+ end
@@ -2,10 +2,10 @@ require 'rubygems'
2
2
  require 'humanize'
3
3
  require 'rspec'
4
4
  require 'timeout'
5
- # require 'pry-byebug'
6
5
 
7
6
  RSpec.configure do |config|
8
7
  config.around(:each) do |example|
9
8
  Timeout.timeout(5, &example)
9
+ Humanize.reset_config
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humanize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Chen
@@ -9,24 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-09-03 00:00:00.000000000 Z
12
+ date: 2018-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rspec
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
- type: :development
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- version: '0'
28
- - !ruby/object:Gem::Dependency
29
- name: mutant
15
+ name: pry-byebug
30
16
  requirement: !ruby/object:Gem::Requirement
31
17
  requirements:
32
18
  - - ">="
@@ -40,7 +26,7 @@ dependencies:
40
26
  - !ruby/object:Gem::Version
41
27
  version: '0'
42
28
  - !ruby/object:Gem::Dependency
43
- name: mutant-rspec
29
+ name: rspec
44
30
  requirement: !ruby/object:Gem::Requirement
45
31
  requirements:
46
32
  - - ">="
@@ -54,7 +40,7 @@ dependencies:
54
40
  - !ruby/object:Gem::Version
55
41
  version: '0'
56
42
  - !ruby/object:Gem::Dependency
57
- name: pry-byebug
43
+ name: rubocop
58
44
  requirement: !ruby/object:Gem::Requirement
59
45
  requirements:
60
46
  - - ">="
@@ -74,26 +60,42 @@ extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
76
62
  - ".gitignore"
63
+ - ".rubocop.yml"
77
64
  - ".travis.yml"
78
65
  - Gemfile
79
66
  - LICENSE.md
80
67
  - README.markdown
81
68
  - Rakefile
82
69
  - Wordlist.source
83
- - bench.rb
84
70
  - bin/console
85
71
  - bin/run_mutant
86
72
  - humanize.gemspec
87
73
  - lib/humanize.rb
88
- - lib/humanize/cache.rb
89
- - lib/humanize/lots.rb
90
- - lib/humanize/words.rb
91
- - prof.rb
92
- - spec/TODO
74
+ - lib/humanize/locales.rb
75
+ - lib/humanize/locales/az.rb
76
+ - lib/humanize/locales/constants/az.rb
77
+ - lib/humanize/locales/constants/de.rb
78
+ - lib/humanize/locales/constants/en.rb
79
+ - lib/humanize/locales/constants/fr.rb
80
+ - lib/humanize/locales/constants/id.rb
81
+ - lib/humanize/locales/constants/th.rb
82
+ - lib/humanize/locales/constants/tr.rb
83
+ - lib/humanize/locales/de.rb
84
+ - lib/humanize/locales/en.rb
85
+ - lib/humanize/locales/fr.rb
86
+ - lib/humanize/locales/id.rb
87
+ - lib/humanize/locales/th.rb
88
+ - lib/humanize/locales/tr.rb
93
89
  - spec/configuration_spec.rb
94
90
  - spec/humanize_spec.rb
91
+ - spec/locales/az_spec.rb
92
+ - spec/locales/de_spec.rb
93
+ - spec/locales/en_spec.rb
94
+ - spec/locales/fr_spec.rb
95
+ - spec/locales/id_spec.rb
96
+ - spec/locales/th_spec.rb
97
+ - spec/locales/tr_spec.rb
95
98
  - spec/spec_helper.rb
96
- - spec/tests.rb
97
99
  homepage: https://github.com/radar/humanize
98
100
  licenses: []
99
101
  metadata: {}
@@ -105,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
107
  requirements:
106
108
  - - ">="
107
109
  - !ruby/object:Gem::Version
108
- version: '2.0'
110
+ version: '2.3'
109
111
  required_rubygems_version: !ruby/object:Gem::Requirement
110
112
  requirements:
111
113
  - - ">="
@@ -113,13 +115,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
115
  version: '0'
114
116
  requirements: []
115
117
  rubyforge_project:
116
- rubygems_version: 2.7.3
118
+ rubygems_version: 2.7.6
117
119
  signing_key:
118
120
  specification_version: 4
119
121
  summary: Extension to Numeric to humanize numbers
120
122
  test_files:
121
- - spec/TODO
122
123
  - spec/configuration_spec.rb
123
124
  - spec/humanize_spec.rb
125
+ - spec/locales/az_spec.rb
126
+ - spec/locales/de_spec.rb
127
+ - spec/locales/en_spec.rb
128
+ - spec/locales/fr_spec.rb
129
+ - spec/locales/id_spec.rb
130
+ - spec/locales/th_spec.rb
131
+ - spec/locales/tr_spec.rb
124
132
  - spec/spec_helper.rb
125
- - spec/tests.rb