money_parser 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/money_parser.rb +1 -0
- data/money_parser.gemspec +2 -2
- data/spec/money_parser_spec.rb +228 -128
- data/specification.rb +4 -0
- data/test/money_parser_spec.js +200 -120
- data/vendor/assets/javascripts/parse_money.js +3 -0
- metadata +2 -2
data/spec/money_parser_spec.rb
CHANGED
@@ -7,6 +7,106 @@ describe MoneyParser do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
|
10
|
+
it '"," should be parsed as nil ' do
|
11
|
+
MoneyParser.parse(",").should == nil
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
it '"$," should be parsed as nil (with a dollar sign)' do
|
16
|
+
MoneyParser.parse("$,").should == nil
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
it '"€," should be parsed as nil (with a euro sign)' do
|
21
|
+
MoneyParser.parse("€,").should == nil
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
it '"£," should be parsed as nil (with a pound sign)' do
|
26
|
+
MoneyParser.parse("£,").should == nil
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
it '"₤," should be parsed as nil (with a pound sign)' do
|
31
|
+
MoneyParser.parse("₤,").should == nil
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
it '",," should be parsed as nil ' do
|
36
|
+
MoneyParser.parse(",,").should == nil
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
it '"$,," should be parsed as nil (with a dollar sign)' do
|
41
|
+
MoneyParser.parse("$,,").should == nil
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
it '"€,," should be parsed as nil (with a euro sign)' do
|
46
|
+
MoneyParser.parse("€,,").should == nil
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
it '"£,," should be parsed as nil (with a pound sign)' do
|
51
|
+
MoneyParser.parse("£,,").should == nil
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
it '"₤,," should be parsed as nil (with a pound sign)' do
|
56
|
+
MoneyParser.parse("₤,,").should == nil
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
it '"." should be parsed as nil ' do
|
61
|
+
MoneyParser.parse(".").should == nil
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
it '"$." should be parsed as nil (with a dollar sign)' do
|
66
|
+
MoneyParser.parse("$.").should == nil
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
it '"€." should be parsed as nil (with a euro sign)' do
|
71
|
+
MoneyParser.parse("€.").should == nil
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
it '"£." should be parsed as nil (with a pound sign)' do
|
76
|
+
MoneyParser.parse("£.").should == nil
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
it '"₤." should be parsed as nil (with a pound sign)' do
|
81
|
+
MoneyParser.parse("₤.").should == nil
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
it '".." should be parsed as nil ' do
|
86
|
+
MoneyParser.parse("..").should == nil
|
87
|
+
end
|
88
|
+
|
89
|
+
|
90
|
+
it '"$.." should be parsed as nil (with a dollar sign)' do
|
91
|
+
MoneyParser.parse("$..").should == nil
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
it '"€.." should be parsed as nil (with a euro sign)' do
|
96
|
+
MoneyParser.parse("€..").should == nil
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
it '"£.." should be parsed as nil (with a pound sign)' do
|
101
|
+
MoneyParser.parse("£..").should == nil
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
it '"₤.." should be parsed as nil (with a pound sign)' do
|
106
|
+
MoneyParser.parse("₤..").should == nil
|
107
|
+
end
|
108
|
+
|
109
|
+
|
10
110
|
it '"2000.01" should be parsed as 2000.01 ' do
|
11
111
|
MoneyParser.parse("2000.01").should == BigDecimal.new("2000.01")
|
12
112
|
end
|
@@ -17,8 +117,8 @@ describe MoneyParser do
|
|
17
117
|
end
|
18
118
|
|
19
119
|
|
20
|
-
it '"
|
21
|
-
MoneyParser.parse("
|
120
|
+
it '"20o0.01" should be parsed as 2000.01 (with O instead of 0)' do
|
121
|
+
MoneyParser.parse("20o0.01").should == BigDecimal.new("2000.01")
|
22
122
|
end
|
23
123
|
|
24
124
|
|
@@ -47,13 +147,13 @@ describe MoneyParser do
|
|
47
147
|
end
|
48
148
|
|
49
149
|
|
50
|
-
it '"
|
51
|
-
MoneyParser.parse("
|
150
|
+
it '"-2000,01" should be parsed as -2000.01 (negative amount)' do
|
151
|
+
MoneyParser.parse("-2000,01").should == BigDecimal.new("-2000.01")
|
52
152
|
end
|
53
153
|
|
54
154
|
|
55
|
-
it '"
|
56
|
-
MoneyParser.parse("
|
155
|
+
it '"2000,o1" should be parsed as 2000.01 (with O instead of 0)' do
|
156
|
+
MoneyParser.parse("2000,o1").should == BigDecimal.new("2000.01")
|
57
157
|
end
|
58
158
|
|
59
159
|
|
@@ -82,13 +182,13 @@ describe MoneyParser do
|
|
82
182
|
end
|
83
183
|
|
84
184
|
|
85
|
-
it '"
|
86
|
-
MoneyParser.parse("
|
185
|
+
it '"-2000.1" should be parsed as -2000.1 (negative amount)' do
|
186
|
+
MoneyParser.parse("-2000.1").should == BigDecimal.new("-2000.1")
|
87
187
|
end
|
88
188
|
|
89
189
|
|
90
|
-
it '"
|
91
|
-
MoneyParser.parse("
|
190
|
+
it '"20o0.1" should be parsed as 2000.1 (with O instead of 0)' do
|
191
|
+
MoneyParser.parse("20o0.1").should == BigDecimal.new("2000.1")
|
92
192
|
end
|
93
193
|
|
94
194
|
|
@@ -117,8 +217,8 @@ describe MoneyParser do
|
|
117
217
|
end
|
118
218
|
|
119
219
|
|
120
|
-
it '"-2000,1" should be parsed as -2000.1 (negative amount)' do
|
121
|
-
MoneyParser.parse("-2000,1").should == BigDecimal.new("-2000.1")
|
220
|
+
it '" -2000,1" should be parsed as -2000.1 (negative amount)' do
|
221
|
+
MoneyParser.parse(" -2000,1").should == BigDecimal.new("-2000.1")
|
122
222
|
end
|
123
223
|
|
124
224
|
|
@@ -152,13 +252,13 @@ describe MoneyParser do
|
|
152
252
|
end
|
153
253
|
|
154
254
|
|
155
|
-
it '"- 2000" should be parsed as -2000.0 (negative amount)' do
|
156
|
-
MoneyParser.parse("- 2000").should == BigDecimal.new("-2000.0")
|
255
|
+
it '" - 2000" should be parsed as -2000.0 (negative amount)' do
|
256
|
+
MoneyParser.parse(" - 2000").should == BigDecimal.new("-2000.0")
|
157
257
|
end
|
158
258
|
|
159
259
|
|
160
|
-
it '"
|
161
|
-
MoneyParser.parse("
|
260
|
+
it '"2o00" should be parsed as 2000.0 (with O instead of 0)' do
|
261
|
+
MoneyParser.parse("2o00").should == BigDecimal.new("2000.0")
|
162
262
|
end
|
163
263
|
|
164
264
|
|
@@ -187,8 +287,8 @@ describe MoneyParser do
|
|
187
287
|
end
|
188
288
|
|
189
289
|
|
190
|
-
it '"
|
191
|
-
MoneyParser.parse("
|
290
|
+
it '"-.01" should be parsed as -0.01 (negative amount)' do
|
291
|
+
MoneyParser.parse("-.01").should == BigDecimal.new("-0.01")
|
192
292
|
end
|
193
293
|
|
194
294
|
|
@@ -262,8 +362,8 @@ describe MoneyParser do
|
|
262
362
|
end
|
263
363
|
|
264
364
|
|
265
|
-
it '"
|
266
|
-
MoneyParser.parse("
|
365
|
+
it '"o.01" should be parsed as 0.01 (with O instead of 0)' do
|
366
|
+
MoneyParser.parse("o.01").should == BigDecimal.new("0.01")
|
267
367
|
end
|
268
368
|
|
269
369
|
|
@@ -297,8 +397,8 @@ describe MoneyParser do
|
|
297
397
|
end
|
298
398
|
|
299
399
|
|
300
|
-
it '"
|
301
|
-
MoneyParser.parse("
|
400
|
+
it '"o,01" should be parsed as 0.01 (with O instead of 0)' do
|
401
|
+
MoneyParser.parse("o,01").should == BigDecimal.new("0.01")
|
302
402
|
end
|
303
403
|
|
304
404
|
|
@@ -327,8 +427,8 @@ describe MoneyParser do
|
|
327
427
|
end
|
328
428
|
|
329
429
|
|
330
|
-
it '"
|
331
|
-
MoneyParser.parse("
|
430
|
+
it '" - .1" should be parsed as -0.1 (negative amount)' do
|
431
|
+
MoneyParser.parse(" - .1").should == BigDecimal.new("-0.1")
|
332
432
|
end
|
333
433
|
|
334
434
|
|
@@ -357,8 +457,8 @@ describe MoneyParser do
|
|
357
457
|
end
|
358
458
|
|
359
459
|
|
360
|
-
it '"
|
361
|
-
MoneyParser.parse("
|
460
|
+
it '"- ,1" should be parsed as -0.1 (negative amount)' do
|
461
|
+
MoneyParser.parse("- ,1").should == BigDecimal.new("-0.1")
|
362
462
|
end
|
363
463
|
|
364
464
|
|
@@ -387,8 +487,8 @@ describe MoneyParser do
|
|
387
487
|
end
|
388
488
|
|
389
489
|
|
390
|
-
it '" -0.1" should be parsed as -0.1 (negative amount)' do
|
391
|
-
MoneyParser.parse(" -0.1").should == BigDecimal.new("-0.1")
|
490
|
+
it '" - 0.1" should be parsed as -0.1 (negative amount)' do
|
491
|
+
MoneyParser.parse(" - 0.1").should == BigDecimal.new("-0.1")
|
392
492
|
end
|
393
493
|
|
394
494
|
|
@@ -422,8 +522,8 @@ describe MoneyParser do
|
|
422
522
|
end
|
423
523
|
|
424
524
|
|
425
|
-
it '"-0,1" should be parsed as -0.1 (negative amount)' do
|
426
|
-
MoneyParser.parse("-0,1").should == BigDecimal.new("-0.1")
|
525
|
+
it '"- 0,1" should be parsed as -0.1 (negative amount)' do
|
526
|
+
MoneyParser.parse("- 0,1").should == BigDecimal.new("-0.1")
|
427
527
|
end
|
428
528
|
|
429
529
|
|
@@ -457,13 +557,13 @@ describe MoneyParser do
|
|
457
557
|
end
|
458
558
|
|
459
559
|
|
460
|
-
it '"
|
461
|
-
MoneyParser.parse("
|
560
|
+
it '"-2,000.01" should be parsed as -2000.01 (negative amount)' do
|
561
|
+
MoneyParser.parse("-2,000.01").should == BigDecimal.new("-2000.01")
|
462
562
|
end
|
463
563
|
|
464
564
|
|
465
|
-
it '"2,
|
466
|
-
MoneyParser.parse("2,
|
565
|
+
it '"2,0o0.01" should be parsed as 2000.01 (with O instead of 0)' do
|
566
|
+
MoneyParser.parse("2,0o0.01").should == BigDecimal.new("2000.01")
|
467
567
|
end
|
468
568
|
|
469
569
|
|
@@ -492,13 +592,13 @@ describe MoneyParser do
|
|
492
592
|
end
|
493
593
|
|
494
594
|
|
495
|
-
it '"
|
496
|
-
MoneyParser.parse("
|
595
|
+
it '"-2.000,01" should be parsed as -2000.01 (negative amount)' do
|
596
|
+
MoneyParser.parse("-2.000,01").should == BigDecimal.new("-2000.01")
|
497
597
|
end
|
498
598
|
|
499
599
|
|
500
|
-
it '"2.
|
501
|
-
MoneyParser.parse("2.
|
600
|
+
it '"2.o00,01" should be parsed as 2000.01 (with O instead of 0)' do
|
601
|
+
MoneyParser.parse("2.o00,01").should == BigDecimal.new("2000.01")
|
502
602
|
end
|
503
603
|
|
504
604
|
|
@@ -527,13 +627,13 @@ describe MoneyParser do
|
|
527
627
|
end
|
528
628
|
|
529
629
|
|
530
|
-
it '"
|
531
|
-
MoneyParser.parse("
|
630
|
+
it '"- 2 000.01" should be parsed as -2000.01 (negative amount)' do
|
631
|
+
MoneyParser.parse("- 2 000.01").should == BigDecimal.new("-2000.01")
|
532
632
|
end
|
533
633
|
|
534
634
|
|
535
|
-
it '"2
|
536
|
-
MoneyParser.parse("2
|
635
|
+
it '"2 000.o1" should be parsed as 2000.01 (with O instead of 0)' do
|
636
|
+
MoneyParser.parse("2 000.o1").should == BigDecimal.new("2000.01")
|
537
637
|
end
|
538
638
|
|
539
639
|
|
@@ -562,13 +662,13 @@ describe MoneyParser do
|
|
562
662
|
end
|
563
663
|
|
564
664
|
|
565
|
-
it '"-2 000,01" should be parsed as -2000.01 (negative amount)' do
|
566
|
-
MoneyParser.parse("-2 000,01").should == BigDecimal.new("-2000.01")
|
665
|
+
it '"- 2 000,01" should be parsed as -2000.01 (negative amount)' do
|
666
|
+
MoneyParser.parse("- 2 000,01").should == BigDecimal.new("-2000.01")
|
567
667
|
end
|
568
668
|
|
569
669
|
|
570
|
-
it '"2
|
571
|
-
MoneyParser.parse("2
|
670
|
+
it '"2 000,o1" should be parsed as 2000.01 (with O instead of 0)' do
|
671
|
+
MoneyParser.parse("2 000,o1").should == BigDecimal.new("2000.01")
|
572
672
|
end
|
573
673
|
|
574
674
|
|
@@ -602,8 +702,8 @@ describe MoneyParser do
|
|
602
702
|
end
|
603
703
|
|
604
704
|
|
605
|
-
it '"1,222,
|
606
|
-
MoneyParser.parse("1,222,
|
705
|
+
it '"1,222,o00.01" should be parsed as 1222000.01 (with O instead of 0)' do
|
706
|
+
MoneyParser.parse("1,222,o00.01").should == BigDecimal.new("1222000.01")
|
607
707
|
end
|
608
708
|
|
609
709
|
|
@@ -632,13 +732,13 @@ describe MoneyParser do
|
|
632
732
|
end
|
633
733
|
|
634
734
|
|
635
|
-
it '"
|
636
|
-
MoneyParser.parse("
|
735
|
+
it '"-1.222.000,01" should be parsed as -1222000.01 (negative amount)' do
|
736
|
+
MoneyParser.parse("-1.222.000,01").should == BigDecimal.new("-1222000.01")
|
637
737
|
end
|
638
738
|
|
639
739
|
|
640
|
-
it '"1.222.
|
641
|
-
MoneyParser.parse("1.222.
|
740
|
+
it '"1.222.0o0,01" should be parsed as 1222000.01 (with O instead of 0)' do
|
741
|
+
MoneyParser.parse("1.222.0o0,01").should == BigDecimal.new("1222000.01")
|
642
742
|
end
|
643
743
|
|
644
744
|
|
@@ -667,8 +767,8 @@ describe MoneyParser do
|
|
667
767
|
end
|
668
768
|
|
669
769
|
|
670
|
-
it '" -
|
671
|
-
MoneyParser.parse(" -
|
770
|
+
it '" -1 222 000.01" should be parsed as -1222000.01 (negative amount)' do
|
771
|
+
MoneyParser.parse(" -1 222 000.01").should == BigDecimal.new("-1222000.01")
|
672
772
|
end
|
673
773
|
|
674
774
|
|
@@ -702,13 +802,13 @@ describe MoneyParser do
|
|
702
802
|
end
|
703
803
|
|
704
804
|
|
705
|
-
it '"- 1 222 000,01" should be parsed as -1222000.01 (negative amount)' do
|
706
|
-
MoneyParser.parse("- 1 222 000,01").should == BigDecimal.new("-1222000.01")
|
805
|
+
it '" - 1 222 000,01" should be parsed as -1222000.01 (negative amount)' do
|
806
|
+
MoneyParser.parse(" - 1 222 000,01").should == BigDecimal.new("-1222000.01")
|
707
807
|
end
|
708
808
|
|
709
809
|
|
710
|
-
it '"1 222
|
711
|
-
MoneyParser.parse("1 222
|
810
|
+
it '"1 222 0o0,01" should be parsed as 1222000.01 (with O instead of 0)' do
|
811
|
+
MoneyParser.parse("1 222 0o0,01").should == BigDecimal.new("1222000.01")
|
712
812
|
end
|
713
813
|
|
714
814
|
|
@@ -737,13 +837,13 @@ describe MoneyParser do
|
|
737
837
|
end
|
738
838
|
|
739
839
|
|
740
|
-
it '"
|
741
|
-
MoneyParser.parse("
|
840
|
+
it '"- 2,000.1" should be parsed as -2000.1 (negative amount)' do
|
841
|
+
MoneyParser.parse("- 2,000.1").should == BigDecimal.new("-2000.1")
|
742
842
|
end
|
743
843
|
|
744
844
|
|
745
|
-
it '"2,
|
746
|
-
MoneyParser.parse("2,
|
845
|
+
it '"2,0o0.1" should be parsed as 2000.1 (with O instead of 0)' do
|
846
|
+
MoneyParser.parse("2,0o0.1").should == BigDecimal.new("2000.1")
|
747
847
|
end
|
748
848
|
|
749
849
|
|
@@ -772,8 +872,8 @@ describe MoneyParser do
|
|
772
872
|
end
|
773
873
|
|
774
874
|
|
775
|
-
it '"-
|
776
|
-
MoneyParser.parse("-
|
875
|
+
it '" -2.000,1" should be parsed as -2000.1 (negative amount)' do
|
876
|
+
MoneyParser.parse(" -2.000,1").should == BigDecimal.new("-2000.1")
|
777
877
|
end
|
778
878
|
|
779
879
|
|
@@ -807,8 +907,8 @@ describe MoneyParser do
|
|
807
907
|
end
|
808
908
|
|
809
909
|
|
810
|
-
it '"-
|
811
|
-
MoneyParser.parse("-
|
910
|
+
it '" -2 000.1" should be parsed as -2000.1 (negative amount)' do
|
911
|
+
MoneyParser.parse(" -2 000.1").should == BigDecimal.new("-2000.1")
|
812
912
|
end
|
813
913
|
|
814
914
|
|
@@ -842,8 +942,8 @@ describe MoneyParser do
|
|
842
942
|
end
|
843
943
|
|
844
944
|
|
845
|
-
it '"-
|
846
|
-
MoneyParser.parse("-
|
945
|
+
it '"-2 000,1" should be parsed as -2000.1 (negative amount)' do
|
946
|
+
MoneyParser.parse("-2 000,1").should == BigDecimal.new("-2000.1")
|
847
947
|
end
|
848
948
|
|
849
949
|
|
@@ -877,13 +977,13 @@ describe MoneyParser do
|
|
877
977
|
end
|
878
978
|
|
879
979
|
|
880
|
-
it '"
|
881
|
-
MoneyParser.parse("
|
980
|
+
it '"-1,222,000.1" should be parsed as -1222000.1 (negative amount)' do
|
981
|
+
MoneyParser.parse("-1,222,000.1").should == BigDecimal.new("-1222000.1")
|
882
982
|
end
|
883
983
|
|
884
984
|
|
885
|
-
it '"1,222,
|
886
|
-
MoneyParser.parse("1,222,
|
985
|
+
it '"1,222,0o0.1" should be parsed as 1222000.1 (with O instead of 0)' do
|
986
|
+
MoneyParser.parse("1,222,0o0.1").should == BigDecimal.new("1222000.1")
|
887
987
|
end
|
888
988
|
|
889
989
|
|
@@ -912,13 +1012,13 @@ describe MoneyParser do
|
|
912
1012
|
end
|
913
1013
|
|
914
1014
|
|
915
|
-
it '"-1.222.000,1" should be parsed as -1222000.1 (negative amount)' do
|
916
|
-
MoneyParser.parse("-1.222.000,1").should == BigDecimal.new("-1222000.1")
|
1015
|
+
it '"- 1.222.000,1" should be parsed as -1222000.1 (negative amount)' do
|
1016
|
+
MoneyParser.parse("- 1.222.000,1").should == BigDecimal.new("-1222000.1")
|
917
1017
|
end
|
918
1018
|
|
919
1019
|
|
920
|
-
it '"1.222.
|
921
|
-
MoneyParser.parse("1.222.
|
1020
|
+
it '"1.222.00o,1" should be parsed as 1222000.1 (with O instead of 0)' do
|
1021
|
+
MoneyParser.parse("1.222.00o,1").should == BigDecimal.new("1222000.1")
|
922
1022
|
end
|
923
1023
|
|
924
1024
|
|
@@ -952,8 +1052,8 @@ describe MoneyParser do
|
|
952
1052
|
end
|
953
1053
|
|
954
1054
|
|
955
|
-
it '"1 222
|
956
|
-
MoneyParser.parse("1 222
|
1055
|
+
it '"1 222 0o0.1" should be parsed as 1222000.1 (with O instead of 0)' do
|
1056
|
+
MoneyParser.parse("1 222 0o0.1").should == BigDecimal.new("1222000.1")
|
957
1057
|
end
|
958
1058
|
|
959
1059
|
|
@@ -982,13 +1082,13 @@ describe MoneyParser do
|
|
982
1082
|
end
|
983
1083
|
|
984
1084
|
|
985
|
-
it '" -
|
986
|
-
MoneyParser.parse(" -
|
1085
|
+
it '" -1 222 000,1" should be parsed as -1222000.1 (negative amount)' do
|
1086
|
+
MoneyParser.parse(" -1 222 000,1").should == BigDecimal.new("-1222000.1")
|
987
1087
|
end
|
988
1088
|
|
989
1089
|
|
990
|
-
it '"1 222
|
991
|
-
MoneyParser.parse("1 222
|
1090
|
+
it '"1 222 00o,1" should be parsed as 1222000.1 (with O instead of 0)' do
|
1091
|
+
MoneyParser.parse("1 222 00o,1").should == BigDecimal.new("1222000.1")
|
992
1092
|
end
|
993
1093
|
|
994
1094
|
|
@@ -1022,8 +1122,8 @@ describe MoneyParser do
|
|
1022
1122
|
end
|
1023
1123
|
|
1024
1124
|
|
1025
|
-
it '"2,
|
1026
|
-
MoneyParser.parse("2,
|
1125
|
+
it '"2,0o0.10" should be parsed as 2000.1 (with O instead of 0)' do
|
1126
|
+
MoneyParser.parse("2,0o0.10").should == BigDecimal.new("2000.1")
|
1027
1127
|
end
|
1028
1128
|
|
1029
1129
|
|
@@ -1052,8 +1152,8 @@ describe MoneyParser do
|
|
1052
1152
|
end
|
1053
1153
|
|
1054
1154
|
|
1055
|
-
it '"-2.000,10" should be parsed as -2000.1 (negative amount)' do
|
1056
|
-
MoneyParser.parse("-2.000,10").should == BigDecimal.new("-2000.1")
|
1155
|
+
it '" - 2.000,10" should be parsed as -2000.1 (negative amount)' do
|
1156
|
+
MoneyParser.parse(" - 2.000,10").should == BigDecimal.new("-2000.1")
|
1057
1157
|
end
|
1058
1158
|
|
1059
1159
|
|
@@ -1087,13 +1187,13 @@ describe MoneyParser do
|
|
1087
1187
|
end
|
1088
1188
|
|
1089
1189
|
|
1090
|
-
it '"-
|
1091
|
-
MoneyParser.parse("-
|
1190
|
+
it '" -2 000.10" should be parsed as -2000.1 (negative amount)' do
|
1191
|
+
MoneyParser.parse(" -2 000.10").should == BigDecimal.new("-2000.1")
|
1092
1192
|
end
|
1093
1193
|
|
1094
1194
|
|
1095
|
-
it '"2
|
1096
|
-
MoneyParser.parse("2
|
1195
|
+
it '"2 o00.10" should be parsed as 2000.1 (with O instead of 0)' do
|
1196
|
+
MoneyParser.parse("2 o00.10").should == BigDecimal.new("2000.1")
|
1097
1197
|
end
|
1098
1198
|
|
1099
1199
|
|
@@ -1122,13 +1222,13 @@ describe MoneyParser do
|
|
1122
1222
|
end
|
1123
1223
|
|
1124
1224
|
|
1125
|
-
it '"-2 000,10" should be parsed as -2000.1 (negative amount)' do
|
1126
|
-
MoneyParser.parse("-2 000,10").should == BigDecimal.new("-2000.1")
|
1225
|
+
it '" - 2 000,10" should be parsed as -2000.1 (negative amount)' do
|
1226
|
+
MoneyParser.parse(" - 2 000,10").should == BigDecimal.new("-2000.1")
|
1127
1227
|
end
|
1128
1228
|
|
1129
1229
|
|
1130
|
-
it '"2
|
1131
|
-
MoneyParser.parse("2
|
1230
|
+
it '"2 00o,10" should be parsed as 2000.1 (with O instead of 0)' do
|
1231
|
+
MoneyParser.parse("2 00o,10").should == BigDecimal.new("2000.1")
|
1132
1232
|
end
|
1133
1233
|
|
1134
1234
|
|
@@ -1162,8 +1262,8 @@ describe MoneyParser do
|
|
1162
1262
|
end
|
1163
1263
|
|
1164
1264
|
|
1165
|
-
it '"1,222,
|
1166
|
-
MoneyParser.parse("1,222,
|
1265
|
+
it '"1,222,00o.10" should be parsed as 1222000.1 (with O instead of 0)' do
|
1266
|
+
MoneyParser.parse("1,222,00o.10").should == BigDecimal.new("1222000.1")
|
1167
1267
|
end
|
1168
1268
|
|
1169
1269
|
|
@@ -1197,8 +1297,8 @@ describe MoneyParser do
|
|
1197
1297
|
end
|
1198
1298
|
|
1199
1299
|
|
1200
|
-
it '"1.222.
|
1201
|
-
MoneyParser.parse("1.222.
|
1300
|
+
it '"1.222.o00,10" should be parsed as 1222000.1 (with O instead of 0)' do
|
1301
|
+
MoneyParser.parse("1.222.o00,10").should == BigDecimal.new("1222000.1")
|
1202
1302
|
end
|
1203
1303
|
|
1204
1304
|
|
@@ -1227,13 +1327,13 @@ describe MoneyParser do
|
|
1227
1327
|
end
|
1228
1328
|
|
1229
1329
|
|
1230
|
-
it '"
|
1231
|
-
MoneyParser.parse("
|
1330
|
+
it '"- 1 222 000.10" should be parsed as -1222000.1 (negative amount)' do
|
1331
|
+
MoneyParser.parse("- 1 222 000.10").should == BigDecimal.new("-1222000.1")
|
1232
1332
|
end
|
1233
1333
|
|
1234
1334
|
|
1235
|
-
it '"1 222
|
1236
|
-
MoneyParser.parse("1 222
|
1335
|
+
it '"1 222 o00.10" should be parsed as 1222000.1 (with O instead of 0)' do
|
1336
|
+
MoneyParser.parse("1 222 o00.10").should == BigDecimal.new("1222000.1")
|
1237
1337
|
end
|
1238
1338
|
|
1239
1339
|
|
@@ -1262,13 +1362,13 @@ describe MoneyParser do
|
|
1262
1362
|
end
|
1263
1363
|
|
1264
1364
|
|
1265
|
-
it '"
|
1266
|
-
MoneyParser.parse("
|
1365
|
+
it '"-1 222 000,10" should be parsed as -1222000.1 (negative amount)' do
|
1366
|
+
MoneyParser.parse("-1 222 000,10").should == BigDecimal.new("-1222000.1")
|
1267
1367
|
end
|
1268
1368
|
|
1269
1369
|
|
1270
|
-
it '"1 222
|
1271
|
-
MoneyParser.parse("1 222
|
1370
|
+
it '"1 222 o00,10" should be parsed as 1222000.1 (with O instead of 0)' do
|
1371
|
+
MoneyParser.parse("1 222 o00,10").should == BigDecimal.new("1222000.1")
|
1272
1372
|
end
|
1273
1373
|
|
1274
1374
|
|
@@ -1302,8 +1402,8 @@ describe MoneyParser do
|
|
1302
1402
|
end
|
1303
1403
|
|
1304
1404
|
|
1305
|
-
it '"1 222
|
1306
|
-
MoneyParser.parse("1 222
|
1405
|
+
it '"1 222 0o0" should be parsed as 1222000.0 (with O instead of 0)' do
|
1406
|
+
MoneyParser.parse("1 222 0o0").should == BigDecimal.new("1222000.0")
|
1307
1407
|
end
|
1308
1408
|
|
1309
1409
|
|
@@ -1332,13 +1432,13 @@ describe MoneyParser do
|
|
1332
1432
|
end
|
1333
1433
|
|
1334
1434
|
|
1335
|
-
it '" -
|
1336
|
-
MoneyParser.parse(" -
|
1435
|
+
it '" -1 222 000" should be parsed as -1222000.0 (negative amount)' do
|
1436
|
+
MoneyParser.parse(" -1 222 000").should == BigDecimal.new("-1222000.0")
|
1337
1437
|
end
|
1338
1438
|
|
1339
1439
|
|
1340
|
-
it '"1 222
|
1341
|
-
MoneyParser.parse("1 222
|
1440
|
+
it '"1 222 o00" should be parsed as 1222000.0 (with O instead of 0)' do
|
1441
|
+
MoneyParser.parse("1 222 o00").should == BigDecimal.new("1222000.0")
|
1342
1442
|
end
|
1343
1443
|
|
1344
1444
|
|
@@ -1367,13 +1467,13 @@ describe MoneyParser do
|
|
1367
1467
|
end
|
1368
1468
|
|
1369
1469
|
|
1370
|
-
it '" -
|
1371
|
-
MoneyParser.parse(" -
|
1470
|
+
it '" -1,222,000" should be parsed as -1222000.0 (negative amount)' do
|
1471
|
+
MoneyParser.parse(" -1,222,000").should == BigDecimal.new("-1222000.0")
|
1372
1472
|
end
|
1373
1473
|
|
1374
1474
|
|
1375
|
-
it '"1,222,
|
1376
|
-
MoneyParser.parse("1,222,
|
1475
|
+
it '"1,222,o00" should be parsed as 1222000.0 (with O instead of 0)' do
|
1476
|
+
MoneyParser.parse("1,222,o00").should == BigDecimal.new("1222000.0")
|
1377
1477
|
end
|
1378
1478
|
|
1379
1479
|
|
@@ -1402,8 +1502,8 @@ describe MoneyParser do
|
|
1402
1502
|
end
|
1403
1503
|
|
1404
1504
|
|
1405
|
-
it '"-
|
1406
|
-
MoneyParser.parse("-
|
1505
|
+
it '" -1.222.000" should be parsed as -1222000.0 (negative amount)' do
|
1506
|
+
MoneyParser.parse(" -1.222.000").should == BigDecimal.new("-1222000.0")
|
1407
1507
|
end
|
1408
1508
|
|
1409
1509
|
|
@@ -1437,8 +1537,8 @@ describe MoneyParser do
|
|
1437
1537
|
end
|
1438
1538
|
|
1439
1539
|
|
1440
|
-
it '"-1 222 000" should be parsed as -1222000.0 (negative amount)' do
|
1441
|
-
MoneyParser.parse("-1 222 000").should == BigDecimal.new("-1222000.0")
|
1540
|
+
it '"- 1 222 000" should be parsed as -1222000.0 (negative amount)' do
|
1541
|
+
MoneyParser.parse("- 1 222 000").should == BigDecimal.new("-1222000.0")
|
1442
1542
|
end
|
1443
1543
|
|
1444
1544
|
|
@@ -1472,13 +1572,13 @@ describe MoneyParser do
|
|
1472
1572
|
end
|
1473
1573
|
|
1474
1574
|
|
1475
|
-
it '"- 1 222 000" should be parsed as -1222000.0 (negative amount)' do
|
1476
|
-
MoneyParser.parse("- 1 222 000").should == BigDecimal.new("-1222000.0")
|
1575
|
+
it '" - 1 222 000" should be parsed as -1222000.0 (negative amount)' do
|
1576
|
+
MoneyParser.parse(" - 1 222 000").should == BigDecimal.new("-1222000.0")
|
1477
1577
|
end
|
1478
1578
|
|
1479
1579
|
|
1480
|
-
it '"1 222
|
1481
|
-
MoneyParser.parse("1 222
|
1580
|
+
it '"1 222 00o" should be parsed as 1222000.0 (with O instead of 0)' do
|
1581
|
+
MoneyParser.parse("1 222 00o").should == BigDecimal.new("1222000.0")
|
1482
1582
|
end
|
1483
1583
|
|
1484
1584
|
|
@@ -1507,8 +1607,8 @@ describe MoneyParser do
|
|
1507
1607
|
end
|
1508
1608
|
|
1509
1609
|
|
1510
|
-
it '"- 2,123" should be parsed as -2123.0 (negative amount)' do
|
1511
|
-
MoneyParser.parse("- 2,123").should == BigDecimal.new("-2123.0")
|
1610
|
+
it '" - 2,123" should be parsed as -2123.0 (negative amount)' do
|
1611
|
+
MoneyParser.parse(" - 2,123").should == BigDecimal.new("-2123.0")
|
1512
1612
|
end
|
1513
1613
|
|
1514
1614
|
|
@@ -1622,8 +1722,8 @@ describe MoneyParser do
|
|
1622
1722
|
end
|
1623
1723
|
|
1624
1724
|
|
1625
|
-
it '"
|
1626
|
-
MoneyParser.parse("
|
1725
|
+
it '"-1" should be parsed as -1.0 (negative amount)' do
|
1726
|
+
MoneyParser.parse("-1").should == BigDecimal.new("-1.0")
|
1627
1727
|
end
|
1628
1728
|
|
1629
1729
|
|